Starting an App in the Dev IDE

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
Traxgeek
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 281
Joined: Wed Jan 09, 2013 10:11 am

Starting an App in the Dev IDE

Post by Traxgeek » Wed Jan 16, 2013 10:57 am

Hi,

At the risk of becoming an official 'Forum Pest' or as being seen as 'stalking' this Forum...

I have created an app in LC - standard sort of thing I'm sure : multiple controls on a set of cards all within/under my main Stack.
The app accesses/uses an SQLite database and needs accees to said DB before it can 'do anything'...
I have, therefore, (I'm a newbie with limited understanding) put an 'Open the DB' script within the main Stack - in fact the 'Open DB' script is called from within an 'On Startup' script within my Stack script/code area.
Without a valid datbase ID the rest of my scripts pretty much all fail safe and simply report "No Datbase connection..."
When I try to test a script on a card (bearing in mind I need access to the info stored in the Database), say to manipulate / display some data, the said script(s) simply report the default "No Database connection..." unless I have run the main Stack code first.

So, to my question :
Is there a way to start my test from the main Stack (so that I include the 'Open Database' script without having to open the main Stack code window and run this first...
I mean, is there a 'Run' button to emulate the app starting up from scratch (like Run 'Main' - sorry, hangups back to VS !) or do I simply need to display the main Stack each time, run the 'On Startup' script there and then run the 'real' script I want to test after that?
I appreciate the flexibility LC offers with regards to the <Apply> and little green 'Play' button adjacent but in many cases I need the app to 'initialise' itself before any particular sub-Script can be run...

Ideas ? Or am I still talking baloney / missing the obvious ?

TIA

Regards.
I'm 'getting there'... just far too slowly !
Mac (Siera) and PC (Win7)
LiveCode 8.1.2 / 7.1.1

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Starting an App in the Dev IDE

Post by Klaus » Wed Jan 16, 2013 11:49 am

Hi Traxgeek,

problem is the way Livecode loads externals (like the db access)!
This happens AFTER the stack and card have opened!

This way you need to do all this "on opencard", no way to get this
to work earlier (statup or preopenstack)!


Best

Klaus

Traxgeek
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 281
Joined: Wed Jan 09, 2013 10:11 am

Re: Starting an App in the Dev IDE

Post by Traxgeek » Thu Jan 17, 2013 6:45 pm

Hi Klaus,

Thanks. I think I'll move my DB code from the StacK 'onStartup' area to the Splash page 'onPreOpen' area.

Should be a pretty simple cut'n'paste job I think with an IF THEN/END overrider to see if the DB is already open or not (don't want unnecessary, multiple, simultaneous connections to the DB !)... Sounds simple enough... well, it does now - a week or so after writing it the other way :? !!!

Again. Many thanks.

Regards.
I'm 'getting there'... just far too slowly !
Mac (Siera) and PC (Win7)
LiveCode 8.1.2 / 7.1.1

Post Reply