[squeak-dev] Morphic buttons

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[squeak-dev] Morphic buttons

Mark Volkmann
I see lots of classes for creating buttons and I'm not sure which one
corresponds most closely to a Java Swing JButton.

Button has onAction: to tell it what to do with the button is pressed, but seems
to have no way to tell it what text to put on the button.

Basic button has label: to tell it the text to appear on the button, but seems
to have no way to tell it what to do when it is pressed.

PluggableButtonMorph allows specifying both (on: and label:), but is maybe more
complicated than what I need.

--
R. Mark Volkmann
Object Computing, Inc.

Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Morphic buttons

K. K. Subramaniam
On Friday 17 Oct 2008 10:06:33 pm R. Mark Volkmann wrote:
> I see lots of classes for creating buttons and I'm not sure which one
> corresponds most closely to a Java Swing JButton.
Every morph is capable of handling events. See its on:send:to: method. The
class EventHandler

If you just need a rectangular button with a label on it, use
SimpleButtonMorph (for text labels) or IconicButton (for graphic labels).
e.g.
        SimpleButtonMorph new label: 'Flash'; target: World;
                        actionSelector: #flash; openInWorld.

HTH .. Subbu