Designing a tab control
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Designing a tab control
Hello,
I wan't to understand how the tab desigh control works. So far when I put a control "Inside" a tab, it is visible either when I click on Tab 1 or Tab 2. Is there a way to have controls belonging to specific tabs meaning that it becomes automatically invisible when another tab is selected?
Thank you
Nicolas
I wan't to understand how the tab desigh control works. So far when I put a control "Inside" a tab, it is visible either when I click on Tab 1 or Tab 2. Is there a way to have controls belonging to specific tabs meaning that it becomes automatically invisible when another tab is selected?
Thank you
Nicolas
Nicolas
LC 7.1 on Windows 8.1 and on MAC OS 10.10.5 Xcode 6.4 - 7.1
LC 7.1 on Windows 8.1 and on MAC OS 10.10.5 Xcode 6.4 - 7.1
Re: Designing a tab control
Hi.
If I understand the question, you are placing an image or other control(s) within the rect of the tab panel control? And want to show or hide those objects based on the user's choice? If so, then simply use the menuPick message in the script of the tab panel itself to manage the visibility of any of those objects. If you need more help with what I just said, write back.
Craig Newman
If I understand the question, you are placing an image or other control(s) within the rect of the tab panel control? And want to show or hide those objects based on the user's choice? If so, then simply use the menuPick message in the script of the tab panel itself to manage the visibility of any of those objects. If you need more help with what I just said, write back.
Craig Newman
Re: Designing a tab control
Hi,
Yes this what I want to do. I thought that Tab control had some internal awareness to do that automatically (I'm coming from other dev environment). By the way, if I may, I think it should because it makes the graphics design quite cumbersome
Thanks for the tip
Nicolas
Yes this what I want to do. I thought that Tab control had some internal awareness to do that automatically (I'm coming from other dev environment). By the way, if I may, I think it should because it makes the graphics design quite cumbersome
Thanks for the tip
Nicolas
Nicolas
LC 7.1 on Windows 8.1 and on MAC OS 10.10.5 Xcode 6.4 - 7.1
LC 7.1 on Windows 8.1 and on MAC OS 10.10.5 Xcode 6.4 - 7.1
Re: Designing a tab control
Hi Nicolas,
here is how I ususally create and script a TABbed button control:
1. I first create some groups that should appear for each "tab"
2. I name these groups like the TABS of the button
3. Place them where they should appear on the "tabs"
4. Then I use the extra parameter of "menupick" that only comes with TABbed button -> menuPick chosenItem,previousTab
and script the button like this:
Hope that helps!
Best
Klaus
here is how I ususally create and script a TABbed button control:
1. I first create some groups that should appear for each "tab"
2. I name these groups like the TABS of the button
3. Place them where they should appear on the "tabs"
4. Then I use the extra parameter of "menupick" that only comes with TABbed button -> menuPick chosenItem,previousTab
and script the button like this:
Code: Select all
on menupick tNewGroup, tOldGroup
lock screen
hide gro tOldGroup
show grp tNewGroup
unlock screen
end menupick
Best
Klaus
Re: Designing a tab control
Nicholas.
Craig
I see your point, but it also restricts the flexibility and power of the control. As Klaus showed, and this is just one adorable way to do it, just a little bit of rolling your own opens limitless other functional capabilities. Why, the kernel of the required handler is even pre-loaded for you. You can do all that you are asking for in a handful of lines of code.if I may, I think it should because it makes the graphics design quite cumbersome
Craig
Re: Designing a tab control
Hi Klaus
This is almost what I did. But I don't quite understand the syntax of point 4. I'd love to have some more understanding. Thanks
All the best
Nicolas
This is almost what I did. But I don't quite understand the syntax of point 4. I'd love to have some more understanding. Thanks
All the best
Nicolas
Nicolas
LC 7.1 on Windows 8.1 and on MAC OS 10.10.5 Xcode 6.4 - 7.1
LC 7.1 on Windows 8.1 and on MAC OS 10.10.5 Xcode 6.4 - 7.1
Re: Designing a tab control
Hi Graig
I see your point. I did use the group object, which is a fantastic implementation especially when you embed one group in another and so forth. But again when you are in the design phase, you have to play with visible / invisible to free space in order to place other controls. May it is just a matter of changing habits
All the best
Nicolas
I see your point. I did use the group object, which is a fantastic implementation especially when you embed one group in another and so forth. But again when you are in the design phase, you have to play with visible / invisible to free space in order to place other controls. May it is just a matter of changing habits

All the best
Nicolas
Nicolas
LC 7.1 on Windows 8.1 and on MAC OS 10.10.5 Xcode 6.4 - 7.1
LC 7.1 on Windows 8.1 and on MAC OS 10.10.5 Xcode 6.4 - 7.1
Re: Designing a tab control
Hi Nicolas,
This handler will also have a SECOND parameter, but only for the TABbed button control,
and that is the TAB that is currently selecte BEFORE you click the new one.
-> menupick NewChosenTab,PreviouslyChosenTab
Taht is why we can hide and show groups so easily without haveg to loops through them and
hide all befoe showing the selected one or whatever we might need to do without this parameter.
Please check these gerat stack to get more of the basics of Livecode, maybe start with stack "Controls"
http://www.hyperactivesw.com/revscriptc ... ences.html
Best
Klaus
ususally the "menupick" command has ONE parameter, the menuitem the user has chosen, right?kolia wrote:But I don't quite understand the syntax of point 4. I'd love to have some more understanding.
This handler will also have a SECOND parameter, but only for the TABbed button control,
and that is the TAB that is currently selecte BEFORE you click the new one.
-> menupick NewChosenTab,PreviouslyChosenTab
Taht is why we can hide and show groups so easily without haveg to loops through them and
hide all befoe showing the selected one or whatever we might need to do without this parameter.
Please check these gerat stack to get more of the basics of Livecode, maybe start with stack "Controls"

http://www.hyperactivesw.com/revscriptc ... ences.html
Best
Klaus
Re: Designing a tab control
Hi Klaus,
I got it, this is so smart.
Thank you
Nicolas
I got it, this is so smart.
Thank you
Nicolas
Nicolas
LC 7.1 on Windows 8.1 and on MAC OS 10.10.5 Xcode 6.4 - 7.1
LC 7.1 on Windows 8.1 and on MAC OS 10.10.5 Xcode 6.4 - 7.1
Re: Designing a tab control
Hi Klaus
I have a weird error: button "Tab Menu": execution error at line 2 (Chunk: can't find background), char 1
I don't understand what is trigerring it
Nicolas
I have a weird error: button "Tab Menu": execution error at line 2 (Chunk: can't find background), char 1
Code: Select all
on menuPick new, old
hide grp old
show grp new
end menuPick
Nicolas
Nicolas
LC 7.1 on Windows 8.1 and on MAC OS 10.10.5 Xcode 6.4 - 7.1
LC 7.1 on Windows 8.1 and on MAC OS 10.10.5 Xcode 6.4 - 7.1
Re: Designing a tab control
Hi Nicolas,
maybe an example will help tpo understand the principle:
A TABbed buttoncontrol with these TABs:
tab1
tab2
tab3
Now you need to have three groups whith the SAME name as the TABs:
group "tab1"
group "tab2
group "tab3"
When the menupick handler is being executed, the parameters will of course contain
the ACTUAL TABs involved!
Example: User clicks "tab2" and the previously selected/visible group was "tab1" then
the parameters of the handler will look like this:
But you obviously do not have a group named NEW nor OLD, so you get this error.
Come on, I know you know what a parameter is!
Best
Klaus
maybe an example will help tpo understand the principle:
A TABbed buttoncontrol with these TABs:
tab1
tab2
tab3
Now you need to have three groups whith the SAME name as the TABs:
group "tab1"
group "tab2
group "tab3"
When the menupick handler is being executed, the parameters will of course contain
the ACTUAL TABs involved!
Example: User clicks "tab2" and the previously selected/visible group was "tab1" then
the parameters of the handler will look like this:
Code: Select all
on menupick new,old
## new = "tab2
## old = "tab1"
...
Come on, I know you know what a parameter is!

Best
Klaus
Re: Designing a tab control
Hi.
Are you sure you renamed the actual tabs "New" and "Old"? Otherwise, out of the box, the handler will be looking for a group named, say, "Tab 1". If you check the variable pane, you can see the values for the two variables "new" and "old". Make sure they reference groups that actually exist.
Craig
Are you sure you renamed the actual tabs "New" and "Old"? Otherwise, out of the box, the handler will be looking for a group named, say, "Tab 1". If you check the variable pane, you can see the values for the two variables "new" and "old". Make sure they reference groups that actually exist.
Craig
Re: Designing a tab control
Hi,
I just omitted to design the group in the second tab. I was focusing on the first tab which is the most important one. Thanks so much for your patience, and your explainations.
I just omitted to design the group in the second tab. I was focusing on the first tab which is the most important one. Thanks so much for your patience, and your explainations.
Nicolas
LC 7.1 on Windows 8.1 and on MAC OS 10.10.5 Xcode 6.4 - 7.1
LC 7.1 on Windows 8.1 and on MAC OS 10.10.5 Xcode 6.4 - 7.1