How to create radio button groups?
Ned Konz
ned at bike-nomad.com
Sun Jul 21 18:35:06 UTC 2002
On Sunday 21 July 2002 10:22 am, Lily Smith wrote:
> I am a newbie. How can I implement a radio button group and then
> deal with the user input accordingly?
I'm no expert, but...
You don't say what language (eToy, Smalltalk) you're using, or which
UI idiom (MVC, Morphic).
However, in Smalltalk programming of Morphic, you can use the stepping
behavior of Morphs to update state. So, for instance, if you have a
particular instance variable that gets set by some buttons, you can
use several EtoyUpdatingThreePhaseButtonMorph that are set up to set
their states based on that value:
b1 := EtoyUpdatingThreePhaseButtonMorph radioButton.
b1 target: someObject;
actionSelector: #value: ;
arguments: { 1 };
getSelector: #isValue: .
b1 position: 100 at 100; openInWorld.
b2 := EtoyUpdatingThreePhaseButtonMorph radioButton.
b2 target: someObject;
actionSelector: #value: ;
arguments: { 2 };
getSelector: #isValue: .
b2 position: 100 at 120; openInWorld.
the code above is untested, and will need to be changed for your
application, but you get the idea.
Or you could use PluggableButtonMorphs and send them #changed:
#someAspect messages from your model; all the PBM's that have a
getSelector of #someAspect would then update themselves (which means
to set their color to their onColor or their offColor).
--
Ned Konz
http://bike-nomad.com
GPG key ID: BEEA7EFE
More information about the Squeak-dev
mailing list
|