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