Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("Layout")
#If B4A
Shared = rp.GetSafeDirDefaultExternal("")
#Else If B4J
xui.SetDataFolder("SS2021B4X")
Shared = xui.DefaultFolder
#Else
Shared = xui.DefaultFolder
#End If
File.MakeDir(Shared, "/Dbs/")
File.MakeDir(Shared, "/Images")
DBFileDir = Shared & "/Dbs/"
ImagesDir = Shared & "/Images/"
' ImagesDir = File.DirAssets 'you could eventually leave the images in the File.DirAssets folder.
File.Delete(DBFileDir, DBFileName) 'can be used to reset the default database.
Log(DBFileDir)
Log(ImagesDir)
If File.Exists(DBFileDir, DBFileName) = True Then
Log("db file does not exist")
File.Copy(File.DirAssets, DBFileName, DBFileDir, DBFileName)
Log("db copied")
Else
Log("db file does exist")
End If
If File.Exists(ImagesDir, "R702.4.2.png") = False Then
File.Copy(File.DirAssets, "R702.4.2.png", ImagesDir, "R702.4.2.png") 'ignore
End If
B4XPages.SetTitle(Me, "SS2021B4X")
If sql.IsInitialized = False Then
Try
#If B4J
sql.InitializeSQLite(DBFileDir, DBFileName,True)
#Else
sql.Initialize(DBFileDir, DBFileName,True)
#End If
Catch
Log("DB Not Initialized")
'CkUser
End Try
Else
End If
Dim resultset As ResultSet = sql.ExecQuery("SELECT name from sqlite_master where type='table'")
Do While resultset.NextRow
Log(resultset.Getstring("name"))
Loop
resultset.Close
'xtblItems.LoadSQLiteDB(Starter.sql,"SELECT DescriptionSubjectLookup, TableNumber as [Table], PageIRC As [IRC Page], PgPDF As [PDF Page] FROM TableList221",True)
'Above edited out with Klaus recommendation in forum 5.20.21 SSS
xtblItems.SingleLine = False
xtblItems.LoadSQLiteDB2(sql,"SELECT DescriptionSubjectLookup, TableNumber as [Table], PageIRC As [IRC Page], PgPDF As [PDF Page] FROM TableList221", False, Array As String("T", "T", "T", "I"))
'Above added after Klaus forum recommendation 5.20.21 SSS
' xtblItems.SetColumnsWidths(Array As Int(350dip, 150dip, 90dip, 75dip))
xtblItems.SetColumnsWidths(Array As Int(250dip, 150dip, 90dip, 75dip))
End Sub