Page 1 of 1
button tab object
Posted: Sat Sep 06, 2008 2:03 am
by kotikoti
Hi all,
Please advice on how I can script the button tab object to always open on a given tab, it appears that, when I select a tab and close that application/stack, on next opening of the stack/card, the last selected tab is the one in view.
Regards
Koti2
Re: button tab object
Posted: Sat Sep 06, 2008 8:00 am
by bangkok
kotikoti wrote:Hi all,
Please advice on how I can script the button tab object to always open on a given tab, it appears that, when I select a tab and close that application/stack, on next opening of the stack/card, the last selected tab is the one in view.
I use :
Code: Select all
set menuhistory of button "tab menu" to TheNumberOfTheTabYouWantToDisplay
Something that you can put into opencard handler.
Posted: Sat Sep 06, 2008 11:31 am
by Janschenkel
There are actually two things that come into play:
1. the tabbed button will retain the value from when it was last saved;
2. a stack isn't really removed from memory when you close it so when you reopen it, everything will be in the status it was in when it was closed.
The easiest solution to cover both circumstances, is to add something like this to your card script:
Code: Select all
on preOpenCard
set the menuHistory of button "Tabbed Button" to 1
pass preOpenCard
end preOpenCard
By setting the menuHistory property of a tabbed button to a number, you choose that 'tab' - doing it in a 'preOpenCard' handler means it happens before the card is displayed, so you don't get any visible transition.
Note that setting the 'menuHistory' property will send the 'menuPick' message to your tabbed button.
Hope this helped,
Jan Schenkel.
Posted: Sat Sep 06, 2008 11:22 pm
by kotikoti
Thanks chaps for this...
Works perfectly, learning more each day...
Janschenkel: on item 2, "a stack isn't really removed from memory ", is this also for a standalone?
If so, when traversing a program using several substack's is it then recommended to close them to reduce memory usage, again thinking aloud on this for I haven't reached that stage as yet..
Koti2
Posted: Sun Sep 07, 2008 10:54 am
by Janschenkel
The behaviour is the same accross the Revolution IDE and the standalones that you create: a stack is indeed not removed from memory unless you set its 'destroyStack' property to 'true' - which may sound alarming, but all it means is that the memory associated with a stack is freed when you close the stack.
Unless you're using huge stacks of several hundreds of megabytes, you're not going to get hurt by the engine's holding onto a stack in memory. And it's not like the memory will slowly fill up - when you re-open the stack, it doesn't spawn a new copy but re-uses the previous copy, sparing the user from loading time and memory.
Where it is important to use this property, is in situations where your stacks are actually 'editor windows' - if you're building a 'document-based' application similar to Excel or Word, where you open and close documents while the application may stay open for weeks.
Hope this clarified the memory retention,
Jan Schenkel.
Posted: Wed Sep 10, 2008 2:35 pm
by kotikoti
Thanks Janschenkel, keeping this noted for future reference.