button tab object
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
button tab object
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
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
Build 160
Version 2.9.0
Platform: Windows
Version 2.9.0
Platform: Windows
Re: button tab object
I use :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.
Code: Select all
set menuhistory of button "tab menu" to TheNumberOfTheTabYouWantToDisplay
-
- VIP Livecode Opensource Backer
- Posts: 977
- Joined: Sat Apr 08, 2006 7:47 am
- Contact:
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:
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.
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
Note that setting the 'menuHistory' property will send the 'menuPick' message to your tabbed button.
Hope this helped,
Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com
www.quartam.com
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
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
Build 160
Version 2.9.0
Platform: Windows
Version 2.9.0
Platform: Windows
-
- VIP Livecode Opensource Backer
- Posts: 977
- Joined: Sat Apr 08, 2006 7:47 am
- Contact:
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.
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.
Quartam Reports & PDF Library for LiveCode
www.quartam.com
www.quartam.com