using what tab

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
greggarcia
Posts: 33
Joined: Mon Apr 27, 2009 3:32 pm
Contact:

using what tab

Post by greggarcia » Thu Dec 10, 2009 10:25 pm

Hello, i am using the tab panel objet with the folowing code:
on menuPick whatTab
visual effect dissolve
go to card whatTab
end menuPick

so i created a stack containing 5 cards, the fisrt one is the start windows the next 4 are who used the tab panel, the problem here is that the "focus" ( i think is the right answer) that colorize the "tab" is not working as i would like, i mean it should move depending what tab i am using however when i back to the start card and then go to next card the focused "tab" is in the last card that i used instead the first "tab" card. How can i made it work?

thanks
Greg

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4163
Joined: Sun Jan 07, 2007 9:12 pm

Re: using what tab

Post by bn » Thu Dec 10, 2009 10:41 pm

Greg,

I dont understand exactly how your tabbed button works but it will not update automatically when you go to card 1 other than by the tabbed button.
You use the menuhistory for this
In an opencard handler you could put this code

Code: Select all

on opencard
    set the menuhistory of button "MyTabbedButton" to the number of this card
end opencard
This assumes that your tabbed button has a tab for every card and then it will work.
If you dont want to put this script into every card you could say in the card script of every card

Code: Select all

on opencard
    upDateMyTabbedButton
end opencard
and in the stack script you put

Code: Select all

on upDateMyTabbedButton
     set the menuhistory of button "MyTabbedButton" to the number of this card
end upDateMyTabbedButton

greggarcia
Posts: 33
Joined: Mon Apr 27, 2009 3:32 pm
Contact:

Re: using what tab

Post by greggarcia » Fri Dec 11, 2009 2:14 am

Hi bn, i got the idea but may be i need explain better: to create this small application i followed the video called "windows object" in the resource center. So i created the "tab panel" objet, changed the name of the "tab" and put it a name called "Tab Menu", as i said it works fine if i moved just between the card created for each tab name, but when a leave this group of card going to another card, when i back to this group of card the "colorize" tab is in the last tab menu i left, i want the first tab menu be the "colorize" if not it will be confused to the final user (in this case, kids under 9 years old)

Thanks again.
greg

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4163
Joined: Sun Jan 07, 2007 9:12 pm

Re: using what tab

Post by bn » Fri Dec 11, 2009 12:32 pm

Greg,
If I understand you correctly then you want the user, when he returns to the substack "preferences" to see the first card instead of the third card from which he left.
To do this you can put in the stack script of the substack

Code: Select all

on resumeStack
  set the menuhistory of button "Tab Menu" to 1
end resumeStack
this will switch the substack to the first card and the colorized tab will be the first tab.
I hope this is what you want.
You could also do this: in the script of the substack put

Code: Select all

on suspendStack
  set the menuHistory of button "Tab Menu" to 1
end suspendStack
this will switch to the first card when the user leaves the preferences substack by going to the mainstack.
You only need one of the scripts.
regards
Bernd

greggarcia
Posts: 33
Joined: Mon Apr 27, 2009 3:32 pm
Contact:

Re: using what tab

Post by greggarcia » Fri Dec 11, 2009 10:39 pm

bn, got the idea thanks so much. Now is working as it has to be.
i just put the scrip in the main button that goes to the first card:
set the menuHistory of button "Tab Menu" to 1
and now i am ready to create the first stand alone application, very elemental and easy but is the first step into runrev.

regards.
greg

Post Reply