Help how to make such widget
Help how to make such widget
Hi all,
I want to make a widget to setup database information, but i'm stuck on how to put script in the opening of stack.
I have search on the newsgroup, which said that widget cannot use on that purpose, can anyone suggest method to make it.
Regards
Terry Ho
I want to make a widget to setup database information, but i'm stuck on how to put script in the opening of stack.
I have search on the newsgroup, which said that widget cannot use on that purpose, can anyone suggest method to make it.
Regards
Terry Ho
Re: Help how to make such widget
Why do you want to make a widget? I always write a relatively simple script to set up my database. It doesn't need a specific GUI and doesn't need direct access to the API of the OS. I see no reason to use LCB, but if you do please enlighten me.
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Re: Help how to make such widget
Hi Mark,
Thanks your reply.
I want to make a database widget, which help the beginner to work with database in livecode.
Once drop the "dbconnect" widget, which has the follow :
Connection type : local/ remote
Db type: sqlite/mysql/odbc/etc
Server ip:
Db path:
Login :
Password:
User just input the above, can easy to make db connect, also reduce input error.
If have the above information, the question is how to put such statement, in the opening of script or opening of the card.
Thanks your reply.
I want to make a database widget, which help the beginner to work with database in livecode.
Once drop the "dbconnect" widget, which has the follow :
Connection type : local/ remote
Db type: sqlite/mysql/odbc/etc
Server ip:
Db path:
Login :
Password:
User just input the above, can easy to make db connect, also reduce input error.
If have the above information, the question is how to put such statement, in the opening of script or opening of the card.
Re: Help how to make such widget
Sounds much more like the job for a grouped control than a widget. I could see it in a stack where you experiment with databases, but once you are building an actual app you will need to code the connection. The control could generate the connection code for use in script though.
I don’t really understand what you are asking about the opening stack though. You need to save the connection information somewhere and then load it to use. But unless you are building a generic DB browser, your stack/app will probably have a limited set of DB connections required.
I don’t really understand what you are asking about the opening stack though. You need to save the connection information somewhere and then load it to use. But unless you are building a generic DB browser, your stack/app will probably have a limited set of DB connections required.
Brian Milby
Script Tracker https://github.com/bwmilby/scriptTracker
Script Tracker https://github.com/bwmilby/scriptTracker
Re: Help how to make such widget
I use the following code, in the pre opening of the stack to make it connect with the DB, if for desktop remote db, it will be more parameter, if have a widget, then it will be more easy to setup the db in each db application. Especially for the beginner
if the environment is mobile then
put specialFolderPath("documents") & "/" & tdbname into tDatabasePath
if there is not a file tDatabasePath then
put specialFolderPath("engine") & "/" & tdbname into eDatabasePath
put URL ("binfile:" & eDatabasePath) into URL ("binfile:" & tDatabasePath)
end if
put revOpenDatabase("sqlite", tDatabasePath, , , , ) into gDBID
set the pdbID of me to gDBID
else
set itemDel to "/"
put item 1 to -2 of (the effective fileName of this stack) into tCurrentPath
put tCurrentpath & "/" & tdbname into tDatabasePath
put revOpenDatabase("sqlite", tDatabasePath, , , , ) into gDBID
set the pdbID of me to gDBID
end if
Also I want to make a set of DB widget, the first one is the connection, which make a standard point the get the connection ID, then it will be table creation widget, browse widget, update form widget and etc. Without the way to put the code in the opening of stack or card. It can not make such things happen. I want to make LC will be more easy to develop db apps in both desktop and mobile.
if the environment is mobile then
put specialFolderPath("documents") & "/" & tdbname into tDatabasePath
if there is not a file tDatabasePath then
put specialFolderPath("engine") & "/" & tdbname into eDatabasePath
put URL ("binfile:" & eDatabasePath) into URL ("binfile:" & tDatabasePath)
end if
put revOpenDatabase("sqlite", tDatabasePath, , , , ) into gDBID
set the pdbID of me to gDBID
else
set itemDel to "/"
put item 1 to -2 of (the effective fileName of this stack) into tCurrentPath
put tCurrentpath & "/" & tdbname into tDatabasePath
put revOpenDatabase("sqlite", tDatabasePath, , , , ) into gDBID
set the pdbID of me to gDBID
end if
Also I want to make a set of DB widget, the first one is the connection, which make a standard point the get the connection ID, then it will be table creation widget, browse widget, update form widget and etc. Without the way to put the code in the opening of stack or card. It can not make such things happen. I want to make LC will be more easy to develop db apps in both desktop and mobile.
Re: Help how to make such widget
I still don’t get the desire to use a LCB widget. I’m not even sure it is possible to easily make a DB connection from there.
What you are describing sounds much more like a LCS library. If you need UI, then a stack. If not, then a script only stack would work.
In either case, I suggest that you build what you want as a simple stack first.
What you are describing sounds much more like a LCS library. If you need UI, then a stack. If not, then a script only stack would work.
In either case, I suggest that you build what you want as a simple stack first.
Brian Milby
Script Tracker https://github.com/bwmilby/scriptTracker
Script Tracker https://github.com/bwmilby/scriptTracker
Re: Help how to make such widget
Attach is lcb, which make some of the user interface, but I can not make some function, due to my lack of some knowledge and livecode library. Please advise.
- Attachments
-
- DbSetup.lcb.zip
- (1.93 KiB) Downloaded 268 times