SimpleButtonMorph class comment
Last updated at 12:53 am UTC on 17 January 2006
Edit SimpleButtonMorph class comment here. Some of this taken from below.
See: SimpleButtonMorph
This comment has now been harvested; feel free to make any additions, but please mark them as such so we can tell the differences. If additions warrant, the comment can go out again.
I am labeled, rectangular morph which allows the user to click me. I can be configured to send my "target" the message "actionSelector" with "arguments" when I am clicked. I may have a label, implemented as a StringMorph.
SimpleButtonMorph new
target: Smalltalk;
label: 'Beep!';
actionSelector: #beep;
openInWorld
Structure:
- instance var
- target
- Object
- The Object to notify upon a click
- actionSelector
- Symbol
- The message to send to Target (#messageName)
- arguments
- Array
- Arguments to send with #actionSelection (optional)
- actWhen
- Symbol
- When to take action: may be #buttonUp (default), #buttonDown, #whilePressed, or #startDrag
- oldColor
- Color
- Used to restore color after click
Another example: a button which quits the image without saving it.
SimpleButtonMorph new
target: Smalltalk;
label: 'quit';
actionSelector: #snapshot:andQuit:;
arguments: (Array with: false with: true);
openInWorld