C CanelaKid Member Licensed User Longtime User Mar 2, 2011 #1 Is there a way to initialise a structure with my values in 1 statement similar to below (Which produces an error on the last statement) Type AlertDefn(Message As String, Sound As Int) Dim Alerts(2) As AlertDefn Alerts = Array As AlertDefn(("Sunday",1), ("Monday",2)) Also what is the correct syntax to open an SQL Database which has a password
Is there a way to initialise a structure with my values in 1 statement similar to below (Which produces an error on the last statement) Type AlertDefn(Message As String, Sound As Int) Dim Alerts(2) As AlertDefn Alerts = Array As AlertDefn(("Sunday",1), ("Monday",2)) Also what is the correct syntax to open an SQL Database which has a password
Erel B4X founder Staff member Licensed User Longtime User Mar 2, 2011 #2 You can create a simple Sub that will act as the type constructor: Code: Copy Sub Create(Message As String, Sound As Int) As AlertDefn Dim A As AlertDefn A.Initialize A.Message = Message A.Sound = Sound Return A End Sub Alerts = Array As AlertDefn(Create("Sunday", 1), Create("Monday", 2)) Upvote 0
You can create a simple Sub that will act as the type constructor: Code: Copy Sub Create(Message As String, Sound As Int) As AlertDefn Dim A As AlertDefn A.Initialize A.Message = Message A.Sound = Sound Return A End Sub Alerts = Array As AlertDefn(Create("Sunday", 1), Create("Monday", 2))
C CanelaKid Member Licensed User Longtime User Mar 2, 2011 #3 Thanks For more complex structures this is little more work than B4PPC but yes, it works fine, I thought I might be missing a trick somewhere. What about the Opening of SQL Databases with Passwords? Last edited: Mar 2, 2011 Upvote 0
Thanks For more complex structures this is little more work than B4PPC but yes, it works fine, I thought I might be missing a trick somewhere. What about the Opening of SQL Databases with Passwords?
Erel B4X founder Staff member Licensed User Longtime User Mar 2, 2011 #4 Actually you cannot create complex structures with Basic4ppc. Basic4ppc structures are implemented as arrays. Basic4android however supports structures of any reasonable complexity. See this for example: http://www.b4x.com/forum/basic4andr...als/6729-creating-linked-list-using-type.html Android SQLite doesn't support encrypted databases. See this thread for a possible solution: http://www.b4x.com/forum/basic4android-updates-questions/7987-android-database-protect.html Upvote 0
Actually you cannot create complex structures with Basic4ppc. Basic4ppc structures are implemented as arrays. Basic4android however supports structures of any reasonable complexity. See this for example: http://www.b4x.com/forum/basic4andr...als/6729-creating-linked-list-using-type.html Android SQLite doesn't support encrypted databases. See this thread for a possible solution: http://www.b4x.com/forum/basic4android-updates-questions/7987-android-database-protect.html