Page 1 of 2

problem with tab panel

Posted: Sat Oct 02, 2010 4:48 am
by pmc
Hi everybody. I can't seems to switch tab panel when i used words like 'Name', 'Family' and numeric numbers. If I name my tab name 'Tab 1', 'Tab 2', the script shows an error. Why?

Re: problem with tab panel

Posted: Sat Oct 02, 2010 8:07 am
by jmburnod
Hi pmc

Various cases are possible
Post your script and we can help you

Best

Jean-àMarc

Re: problem with tab panel

Posted: Sat Oct 02, 2010 8:39 am
by pmc
Hi thanks. Image 'capture4' is the script. 'Capture5' is the card's name. 'Capture6' is Tab. Why is the 'Family' color in the script different and why can't I use the word 'Family'?
BTW I have solve the Tab1,2 and 3 problem. I have type a space between the 'Tab1' in the script. Instead of 'Tab1', i put in 'Tab 1'. I didn't know that spaces are not allow in the script.
Thanks in advance.

Re: problem with tab panel

Posted: Sat Oct 02, 2010 8:58 am
by bn
Hi pmc,

family is a reserved word. It is used by Livecode, you can not use it to name an object. Look it up in the dictionary. The coloring indicates that it is a reserved name.

Just give your card an other name.

Edit: I forgot to tell you that it is probably a good idea to put quotes around names. If you dont then Livecode will first think it is a varible and only if that variable is not filled will it use it literally.
You might get away with not quoting but it will make mistakes hard to handle, for example if you use the name also as a variable name then you get into trouble.

So: dont use reserved words (even quoted) and quote your literals.

regards
Bernd

Re: problem with tab panel

Posted: Sat Oct 02, 2010 10:24 am
by pmc
Thanks, Bernd. Help appreciated. I think I'll put in the 'quote'. It is just for a few naming. Thanks.

Re: problem with tab panel

Posted: Sat Oct 02, 2010 11:18 am
by Klaus
Hi pmc,

please check the docs (Rev Dictionary), which aren't that bad actually!, for "menupick"!
There is a special syntax for TABBED buttons, sou you just need ONE handler for your navigation:

Code: Select all

on menupick NewTab, OldTab
   ## In your case do this:
   go cd NewTab
end menupick
Best

Klaus

Re: problem with tab panel

Posted: Sun Oct 03, 2010 4:17 pm
by pmc
Hi Klaus

You are a genius. Thanks. Your script is short and to the point. Now I want need to have a particular tab open whenever I go to that stack. For instance, when I open stack A, I need the tab to be on the 1st tab all the time. I tried this :
on stack open
go to tab 1st
end

It doesn't work.

The learning curve is very steep for livecode.

Re: problem with tab panel

Posted: Sun Oct 03, 2010 4:37 pm
by Klaus
Hi pmc,

you need to set the "menuhistory" of your tabbed button to the NUMBER of the line containing the desired "Tab":

Code: Select all

on openstack
  ...
  set the menuhistory of btn "your tab btn here" of cd X to 1
  ...
end openstack
To ease the learning curve I advice you to work through some or all stack here:
http://www.runrev.com/developers/lesson ... onferences

Best

Klaus

Re: problem with tab panel

Posted: Mon Oct 04, 2010 4:23 pm
by pmc
Hi Klaus
The script as below:

on menupick NewTab, OldTab
## Changing between Tabs:
go cd NewTab
end menupick
on openstack
set the menuhistory of btn 'Home' of cd X to 1
end openstack

It isn't working. The tab remains at the last when open.

Re: problem with tab panel

Posted: Mon Oct 04, 2010 4:26 pm
by Klaus
Hi pmc,

the script is OK, trust me :D

Remember that "openstack" will only get sent ONCE when the stack opens and appears aon screen
Maybe you mean/should try "opencard" or even "preopencard"?


Best

Klaus

Re: problem with tab panel

Posted: Mon Oct 04, 2010 5:01 pm
by pmc
I have tried it with
openstack and preopenstack and even opencard

it still goes to the last tab which was open.
This script is supposed to be on the button (which opens the card with the tab panel) or on the tab panel of the card itself?

Re: problem with tab panel

Posted: Mon Oct 04, 2010 5:24 pm
by Klaus
Hi pmc,
pmc wrote:I have tried it with
openstack and preopenstack and even opencard

it still goes to the last tab which was open.
This script is supposed to be on the button (which opens the card with the tab panel) or on the tab panel of the card itself?
Neither nor! Since these messages are never sent to a button!

It looks like you should put it into the button that opens the card with the TABBED button.
And of course in the "mouseup" handler! 8)


Best

Klaus

Re: problem with tab panel

Posted: Mon Oct 04, 2010 5:59 pm
by pmc
Thanks Klaus.
I got an error message with the script.

Re: problem with tab panel

Posted: Mon Oct 04, 2010 6:08 pm
by Klaus
Hi pmc,

-> set the menuhistory of btn 'Home' of cd X to 1
OH, COME ON! 8)

My good education prohibits further comments! :D

Re: problem with tab panel

Posted: Mon Oct 04, 2010 6:55 pm
by pmc
Sorry, Klaus. I thought it was some kinda of script or code. I really do not understand the script.

set the menuhistory of btn 'Name' of cd "Name" to 1

when we said :
menuhistory of btn...

which btn are we talking about? Is it the Tab? Is the Tab also consider a btn in this case?

Thanks Klaus. Please do not get agitated by my stupidity.