From: zavpublic-spamblock-mac.com
Subject: Re: [DIRECT-L] UI framework code. Radio buttons 2. Code.
Date: February 4, 2007 1:15:44 PM CST
To: DIRECT-L-spamblock-LISTSERV.UARK.EDU
Reply-To: DIRECT-L-spamblock-LISTSERV.UARK.EDU
URL:
forthcoming in a sec
To recap, radio buttons are build off of toggle buttons which are built off of regular buttons.
If you know how to make a toggle button, you know how to make a radio button. There are only two additional scripts required.
The radio buttons belong to a radio button group. Because of this group, when a button is clicked, it can say "I am the one who is selected and all the others are not." This means virtually no work for you to make this work.
Groups are named, like buttons are therefore, the registry must be inited with InitRegistry.
For the Toggle button to be a radio button, all that is needed is to name it appropriately, make it part of a group and apply radio button selection logic to it.
These two behaviours are required:
Button Group Member
Radio Button Success Behaviour
In the example, a success script that automatically displays the entire selected states of the radio button group is called, directing output into the message window.
Also, a different sprite naming script is used so that the automatic naming doesn't create a bunch of buttons with the same name, which would be rather non productive.
The complete scriptlist and behaviour order for a fully functional radio button should look like this:
Button sprite specific subclass - sprite - 1
Register/Unregister button
Root Toggle button sprite subclass
Button Group Member
Change cursor on rollover to hand
Radio Button Success Behaviour
Adding "Get Button Group State" will display the state of which thing is selected. You can modify this script to talk to whatever object cares about the thing selected in the radio button group.
Now, at this point, we can see that the buttons might appear to be a getting a little behaviour heavy. Currently, I'm working on scripts for authoring time to create a button for you by populating the scriptList. However, it is important for you to understand how these things are made up before you simply type one line and have it all made for you.
Now, much like toggle buttons where the buttons may have text next to them that act like the button, we can do the same thing here. In the example provided, the event redirection script has been applied to the text next to the radio button in the lower example. Of course, all desired events have been checked and the target button has been specified.
Check it out.
Finally, you can declare a default radio button by using the active "selected" state graphic instead of the plain old active one. Or sending a message to a button to perform a success or to set the set the toggled state of it.
Since we have all of this group functionality now, how do we access and control it? Well, if you look in the "Registry public movie scripts" you'll see the group accessors at the bottom of the script in their self explanatory wonderfulness.
GetGroupMembers myGroup
GetAllGroups
DoesGroupExist myGroup
DoesGroupNotExist myGroup
And in:
Additional Radio button Accessors
GetRadioButtonGroupState myGroup
GetToggleButtonGroupState myGroup
GetButtonToggledState myButtonName
When the sample is running, you can see all the items available by typing the following in the message window:
put GetallbuttonNames()
put GetAllGroups()
What is awesome is that since all these functionalities are extensions of that which come before them, all the functionality that worked for basic buttons also works here.
---
Macromedia Director Mailing List (Direct-L)
List Administrator: Eve M. Owens (emowens-spamblock-theserver.uark.edu)
To SUBSCRIBE or to UNSUBSCRIBE go to
and click on
"Join or leave the list (or change settings)"
For list archives