This Question is Answered

13 "helpful" answers available (3 pts)
4 Replies Last post: Sep 3, 2008 5:57 AM by Kamal

TabPane revise the label on the issue

Sep 2, 2008 11:27 PM

Click to view zhuxf's profile Level 1 zhuxf 2 posts since
Aug 12, 2008
Please tell me that TabPane of the Label control how to become a CommandButton control.

thank you.
Click to view varshuj's profile Level 3 varshuj 44 posts since
Mar 6, 2008
1. Re: TabPane revise the label on the issue Sep 2, 2008 11:42 PM
do you mean TabPane with label as commanbutton?
for example:

{TabPane
        label = {CommandButton label = "Click"},
        tab-button-tooltip = "button",       
        {TextField}
    }
Click to view zhuxf's profile Level 1 zhuxf 2 posts since
Aug 12, 2008
2. Re: TabPane revise the label on the issue Sep 3, 2008 12:03 AM
Not entirely right, Label completely replace the use CommandButton. When you click the effect CommandButton Label and click the effect should be the same. For example: in a
TabContainer, click TabPane the CommandButton, the TabPane should be able to switch between the.
Click to view carl's profile Curl carl 74 posts since
Oct 17, 2007
3. Re: TabPane revise the label on the issue Sep 3, 2008 12:04 AM
in response to: varshuj
As your example shows, you can use pretty much anything as a label.

Also, in the skinnable ControlUIs, all of the TabPane labels are already CommandButtons. Though that should only generally matter to someone subclassing some part of the UI, its ControlFeel, or its ControlSkin.
Click to view Kamal's profile Curl Kamal 139 posts since
Oct 17, 2007
4. Re: TabPane revise the label on the issue Sep 3, 2008 5:58 AM
in response to: zhuxf
Varsha is almost right. That is the way you would need to change the label for a TabPane in a TabContainer. However she missed one important part here. Note that a CommandButton will consume the PointerPress and PointerRelease events and hence the TabContainer will never get a chance to see it and so the Tabs will not be changed when you click on a TabPane with a CommandButton Label. Here is some code that shows you how to fix the problem:

In the example below I have two TabPanes with labels as a CommandButton. In Curl 6.0, a CommandButton can fire an Action event on a PointerPress. I am adding this case here because, normally, a TabContainer switches its Tabs when a PointerPress is done on a Label.


{curl 6.0, 7.0 applet}
{curl-file-attributes character-encoding = "utf8"}
 
{let constant tp1:TabPane =
    {TabPane
        label =
            {CommandButton
                label = "On pointer Release",
                {on Action do
                    {if-non-null tc = tp1.tab-container then
                        {tc.show-pane tp1}
                    }
                }
            },
        tab-button-tooltip = "first tab",
        {TextFlowBox font-size = 28pt, "1"}
    }
}
 
{let constant tp3:TabPane =
    {TabPane
        label =
            {CommandButton
                label = "On PointerPress",
                fire-on-press? = true,
                {on Action do
                    {if-non-null tc = tp3.tab-container then
                        {tc.show-pane tp3}
                    }
                }
            },
        tab-button-tooltip = "third tab",
        {TextFlowBox font-size = 28pt, "3"}
    }
}
 
 
{TabContainer
    tp1,
    {TabPane
        label = "2",
        tab-button-tooltip = "second tab",
        show? = true,
        {TextFlowBox font-size = 28pt, "2"}
    },
    tp3
}
 
 


Message was edited by: Kamal