User Tools

Site Tools


sample_code:introspector

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
sample_code:introspector [2014/10/13 16:02]
stevegarman
sample_code:introspector [2015/03/28 20:01]
octazid [The code] Change Database to Open
Line 25: Line 25:
 var docfold = "/sdcard/sjgDocs/androidscript/"+vers; var docfold = "/sdcard/sjgDocs/androidscript/"+vers;
 var docfile = docfold + "/null.txt"; var docfile = docfold + "/null.txt";
 +var evalsfile = docfold + "/evals.txt"
  
 //Called when application is started. //Called when application is started.
Line 39: Line 40:
  
     var control_list = "app,layout,Manually entered code,Button,CameraView,CheckBox"     var control_list = "app,layout,Manually entered code,Button,CameraView,CheckBox"
-      +",Crypt,Dialog,Email,Image,List,Locator,Notification,SeekBar"+      +",Crypt,Database,Dialog,Email,Image,List,Locator,Notification,SeekBar"
       +",Sensor,SMS,Spinner,Text,TextEdit,ToggleButton"       +",Sensor,SMS,Spinner,Text,TextEdit,ToggleButton"
       +",WebServer,WebView,YesNoDialog"       +",WebServer,WebView,YesNoDialog"
Line 55: Line 56:
   /**** prepare detail view ****/   /**** prepare detail view ****/
  
-    FunctionView = app.CreateTextEdit('');+    FunctionView = app.CreateTextEdit('',-1,-1); 
 +//FunctionView = app.CreateTextEdit('',-1,-1,"nospell");
     PageArea.AddChild(FunctionView);     PageArea.AddChild(FunctionView);
     FunctionView.SetVisibility('Hide');     FunctionView.SetVisibility('Hide');
Line 112: Line 114:
     case "Crypt":     case "Crypt":
         myobj = app.CreateCrypt();         myobj = app.CreateCrypt();
 +        break;
 +    case "Database":
 +        myobj = app.OpenDatabase("MyData");
         break;         break;
     case "Dialog":     case "Dialog":
Line 161: Line 166:
         myobj=app;         myobj=app;
         lastMenu = "app";         lastMenu = "app";
-    }   +    }
   prepareFunctionList();   prepareFunctionList();
   showOverview();   showOverview();
Line 238: Line 243:
     var layDlg = app.CreateLayout( "linear", "vertical,fillxy,left" );     var layDlg = app.CreateLayout( "linear", "vertical,fillxy,left" );
     layDlg.SetPadding( 0.02, 0, 0.02, 0.02 );     layDlg.SetPadding( 0.02, 0, 0.02, 0.02 );
-    edtDlg = app.CreateTextEdit('app.CreateText( "Hello" )');+    edtDlg = app.CreateTextEdit('app.CreateText( "Hello" )',-1,-1,'NoSpell');
     edtDlg.SetCursorPos(edtDlg.GetText().length);     edtDlg.SetCursorPos(edtDlg.GetText().length);
     layDlg.AddChild(edtDlg);     layDlg.AddChild(edtDlg);
Line 257: Line 262:
     dlg.Dismiss();     dlg.Dismiss();
     myobj = eval(edtDlg.GetText());     myobj = eval(edtDlg.GetText());
-    prepareFunctionList(); +    if ((myobj != null) && (myobj.hasOwnProperty("GetType"))){
-    showOverview(); +
-    if ((myobj != null) && (myobj.hasOwnProperty("GetType")))+
       lastMenu = myobj.GetType();       lastMenu = myobj.GetType();
-    else+      app.WriteFile(evalsfile, edtDlg.GetText()+"\n","append"); 
 +    } 
 +    else{
       lastMenu = "Eval";       lastMenu = "Eval";
 +    }
     main_header_txt.SetText( lastMenu );     main_header_txt.SetText( lastMenu );
 +    prepareFunctionList();
 +    showOverview();
 }//dlg_ok }//dlg_ok
 function dlg_canc(){ function dlg_canc(){
Line 274: Line 282:
 I have placed an spk of this app at [[http://hudl.sgarman.net/public/spk/SJGinspect.spk]] which should create a project in the DroidScript IDE for you. I have placed an spk of this app at [[http://hudl.sgarman.net/public/spk/SJGinspect.spk]] which should create a project in the DroidScript IDE for you.
  
-And for the sake of completeness, there is an apk at [[http://androidscript.sgarman.net/apk/SJGinspect.apk]] which you could download and install if your device is set up to allow apks that don't come from Google Play.+And for the sake of completeness, there is an apk at [[http://droidscript.sgarman.net/apk/SJGinspect.apk]] which you could download and install if your device is set up to allow apks that don't come from Google Play.
sample_code/introspector.txt · Last modified: 2015/03/29 05:06 (external edit)