Tabbed buttons
Ken Ray
kray at sonsothunder.com
Wed Sep 28 15:26:38 EDT 2005
On 9/28/05 2:10 PM, "Stephen Barncard" <stephenREVOLUTION at barncard.com>
wrote:
> Is there an internal message to send to a tabbed button to select a
> state under script control? In some situations the hilite (selection,
> whatever) can get out of sync.
>
> Or is the only way to do it is using "click at" ?
No, you can "set the menuHistory of <buttonDescriptor> to <tabNumber>" which
not only changes the tab to the right tab, but it acts like the tab was
selected (i.e. it runs the menuPick handler).
For example, if you had a tabbed button with three tabs: "Apple", "Orange",
"Banana", and "Orange" was currently active and you wanted to change it so
that "Apple" is the current tab and acting like it was clicked on, you can
do:
set the menuHistory of btn "tabs" to 1
If you don't know the number, you can do this:
set the wholeMatches to true
set the menuHistory of btn "tabs" to lineOffset("Banana",btn "tabs")
If for some reason you want the tab to change, but you *don't* want to have
it run the menuPick handler, you can surround it with "lock messages", as
in:
set the wholeMatches to true
lock messages
set the menuHistory of btn "tabs" to lineOffset("Banana",btn "tabs")
unlock messages
Hope this helps,
Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com
More information about the use-livecode
mailing list