First screen in app

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
phaworth
Posts: 592
Joined: Thu Jun 11, 2009 9:51 pm

First screen in app

Post by phaworth » Tue Sep 01, 2009 9:14 pm

Got some questions regarding what happens when a Rev app starts up.

Right now, my main stack is one that contains cards for maintaining the data in the app, so when I start the app, it brings up the first card in that stack.

What I want to happen is for another card to be displayed at startup, which would be a pallette (I think) containing several buttons that allow the user to choose what functions to perform.

I think I know how to change what is currently the main stack into a substack and make a new mainstack with the palette card in it, but I have a whole bunch of general purpose handlers that are in the stack script of what is currently the main stack.

Should I simply copy all these handlers from the old main stack to the new one? Or is there a better place for these handlers to be so I don;t have to move them again if I change the stack structure of the ap again?

Thanks,
Pete

SparkOut
Posts: 2944
Joined: Sun Sep 23, 2007 4:58 pm

Post by SparkOut » Wed Sep 02, 2009 9:27 am

"Better" is a subjective word, so it's up to you. You can do all sorts of things and they can all make sense in a given situation.
It sounds like a library stack would suit you in this scenario though. For general purpose scripts that you want to be able to make available across other projects or on changing structure of this one, you could put all the generic handlers into a stack on their own. Save that and you can reuse it in other projects.
Import it into your current project by setting the mainstack of the library stack (eg have them both open in the IDE and in the Property Inspector use the dropdown option to set the parent stack of the library stack).
Then on openStack of the mainstack issue the command: start using stack "libraryStack"
That will include the library stack in the message path so that all the handlers in it will be available to all the cards and objects in the current project.
There are other ways, as I said, but this will be simple and portable.

phaworth
Posts: 592
Joined: Thu Jun 11, 2009 9:51 pm

Post by phaworth » Wed Sep 02, 2009 4:30 pm

Thanks, that sounds like it does what I need. One question that comes to mind is if this technique will be OK when I create a standalone app?
Pete

SparkOut
Posts: 2944
Joined: Sun Sep 23, 2007 4:58 pm

Post by SparkOut » Fri Sep 04, 2009 9:07 am

Yes, absolutely.

phaworth
Posts: 592
Joined: Thu Jun 11, 2009 9:51 pm

Post by phaworth » Fri Sep 04, 2009 4:42 pm

Thanks, this all seems to be working great.

Post Reply