problem with tab panel

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

pmc
Posts: 62
Joined: Thu Sep 23, 2010 3:14 am

problem with tab panel

Post by pmc » Sat Oct 02, 2010 4:48 am

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?

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: problem with tab panel

Post by jmburnod » Sat Oct 02, 2010 8:07 am

Hi pmc

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

Best

Jean-àMarc
https://alternatic.ch

pmc
Posts: 62
Joined: Thu Sep 23, 2010 3:14 am

Re: problem with tab panel

Post by pmc » Sat Oct 02, 2010 8:39 am

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.
Attachments
Capture6.GIF
Capture6.GIF (2.94 KiB) Viewed 8355 times
Capture5.GIF
Capture5.GIF (6.6 KiB) Viewed 8355 times
Capture4.GIF
Capture4.GIF (3.6 KiB) Viewed 8355 times

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

Re: problem with tab panel

Post by bn » Sat Oct 02, 2010 8:58 am

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

pmc
Posts: 62
Joined: Thu Sep 23, 2010 3:14 am

Re: problem with tab panel

Post by pmc » Sat Oct 02, 2010 10:24 am

Thanks, Bernd. Help appreciated. I think I'll put in the 'quote'. It is just for a few naming. Thanks.

Klaus
Posts: 14198
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: problem with tab panel

Post by Klaus » Sat Oct 02, 2010 11:18 am

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

pmc
Posts: 62
Joined: Thu Sep 23, 2010 3:14 am

Re: problem with tab panel

Post by pmc » Sun Oct 03, 2010 4:17 pm

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.

Klaus
Posts: 14198
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: problem with tab panel

Post by Klaus » Sun Oct 03, 2010 4:37 pm

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

pmc
Posts: 62
Joined: Thu Sep 23, 2010 3:14 am

Re: problem with tab panel

Post by pmc » Mon Oct 04, 2010 4:23 pm

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.

Klaus
Posts: 14198
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: problem with tab panel

Post by Klaus » Mon Oct 04, 2010 4:26 pm

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

pmc
Posts: 62
Joined: Thu Sep 23, 2010 3:14 am

Re: problem with tab panel

Post by pmc » Mon Oct 04, 2010 5:01 pm

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?

Klaus
Posts: 14198
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: problem with tab panel

Post by Klaus » Mon Oct 04, 2010 5:24 pm

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

pmc
Posts: 62
Joined: Thu Sep 23, 2010 3:14 am

Re: problem with tab panel

Post by pmc » Mon Oct 04, 2010 5:59 pm

Thanks Klaus.
I got an error message with the script.
Attachments
Capture1.GIF
Capture1.GIF (19.59 KiB) Viewed 8293 times

Klaus
Posts: 14198
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: problem with tab panel

Post by Klaus » Mon Oct 04, 2010 6:08 pm

Hi pmc,

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

My good education prohibits further comments! :D

pmc
Posts: 62
Joined: Thu Sep 23, 2010 3:14 am

Re: problem with tab panel

Post by pmc » Mon Oct 04, 2010 6:55 pm

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.

Post Reply