User Tools

Site Tools


sample_code:database_navigate

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:database_navigate [2015/04/17 00:53]
yep
sample_code:database_navigate [2015/04/20 22:48]
82.125.130.65
Line 1: Line 1:
 ======Application: view Droidscript databases====== ======Application: view Droidscript databases======
 I created this simple application to learn and play Databases and Dialogs I created this simple application to learn and play Databases and Dialogs
-  * Identify the sqlite databases in the default folder used by Droidscript.+  * Identify the sqlite databases in the default folder used by Droidscript. (var target)
   * List the tables   * List the tables
   * List Columns of tables   * List Columns of tables
Line 11: Line 11:
 I leave text, the code for icons is kepts inside ... see the 3 tCol I leave text, the code for icons is kepts inside ... see the 3 tCol
  
-enjoy+And if you do not have a database, use the Sample, and verify the database : MyData.  
 + 
 +enjoy. Sorry few French comments.
  
 <code JavaScript AdminDB.js> <code JavaScript AdminDB.js>
Line 79: Line 81:
   remindColumn.SetTextColor( colorTitle );   remindColumn.SetTextColor( colorTitle );
          
- tColGauche=app.CreateText("db files",0.33); +  // titles 3 columns,  text or image if found 
- //tColGauche= app.CreateImage("Img/database.png",0.07); +  var colorTitle="#0033dd"; 
 +  if (app.FileExists( "Img/database.png")){ 
 +    tColGauche= app.CreateImage("Img/database.png",0.07);  
 +    tColGauche.SetMargins( 0.1,0.003,0,0.004 );  
 +  } else { 
 +    tColGauche=app.CreateText("db files",0.33); 
 +    tColGauche.SetTextColor( colorTitle ); 
 +  }
   lh1.AddChild(tColGauche);   lh1.AddChild(tColGauche);
-  //tColGauche.SetMargins( 0.1,0.003,0,0.004 );  +    tColGauche.SetOnTouch( btnD_OnTouch ); 
-  tColGauche.SetOnTouch( btnD_OnTouch ); +   
- +  if (app.FileExists( "Img/table.png")){ 
- tColCentre=app.CreateText("tables",0.33); +    tColCentre=app.CreateImage("Img/table.png",0.07);  
- //tColCentre=app.CreateImage("Img/table.png",0.07);+    tColCentre.SetMargins( 0.29,0.003,0.29,0.004 ); 
 +   } else { 
 +    tColCentre=app.CreateText("tables",0.33); 
 +    tColCentre.SetTextColorcolorTitle ); 
 +  }
   lh1.AddChild(tColCentre);   lh1.AddChild(tColCentre);
-  //tColCentre.SetMargins( 0.29,0.003,0.29,0.004 ); +    tColCentre.SetOnTouch( btnT_OnTouch ); 
-  tColCentre.SetOnTouch( btnT_OnTouch ); +     
- + if (app.FileExists( "Img/column.png")){ 
- tColDroite=app.CreateText("column",0.33); +    tColDroite=app.CreateImage("Img/column.png",0.07);  
- //tColDroite=app.CreateImage("Img/column.png",0.07);+    tColDroite.SetMargins( 0,0.003,0.1,0.004 ); 
 +   } else { 
 +    tColDroite=app.CreateText("column",0.33); 
 +    tColDroite.SetTextColorcolorTitle ); 
 +  }
   lh1.AddChild(tColDroite);   lh1.AddChild(tColDroite);
-  //tColDroite.SetMargins( 0,0.003,0.1,0.004 );  +    tColDroite.SetOnTouch( btnF_OnTouch ); 
-  tColDroite.SetOnTouch( btnF_OnTouch );+    
  
-  var colorTitle="#0033dd"; 
-  tColGauche.SetTextColor( colorTitle ); 
-  tColCentre.SetTextColor( colorTitle ); 
-  tColDroite.SetTextColor( colorTitle ); 
-   
  // faire des listes  // faire des listes
  lstLeft = app.CreateList( "", 0.7, 0.6 );   lstLeft = app.CreateList( "", 0.7, 0.6 ); 
Line 157: Line 169:
  
  
-function emptyList(list) {+function emptyListSlow(list) {
  // pas certain des separateurs: virgule ou CR ou autre?  // pas certain des separateurs: virgule ou CR ou autre?
  var itemString=list.GetList(",");  var itemString=list.GetList(",");
Line 170: Line 182:
  }  }
 } }
 +function emptyList(list)  {
 +  // I learnt this is possible 
 +  list.SetList("") ;
 + 
  
  
sample_code/database_navigate.txt · Last modified: 2015/04/23 20:59 (external edit)