|
Pharo /
ButtonsToActionsAssociating a button to an action is done by creating a method to be called, then giving that method as a symbol to the button entry. Look at this code from in MyGUI rowCoolerAdjustment: dialog which creates the button in that row: rowCoolerAdjustment: dialog ^dialog newRow: {
....
dialog
newButtonFor: self
getState: nil
action: #setCoolerAdjustment
arguments: nil "if args, use { xx. xxx.}"
getEnabled: nil
label: 'c: Cooler Adjust'
help: 'helpText'.
}.
This is the 'long form'. When the button (which will say "c: Cooler Adjust") is clicked the button will look for a method called 'setCoolerAdjustment' in MyGUI. Because that method does not require any parameters, arguments is 'nil'. Notice the comments after arguments: nil. If instead of calling something with no arguments (myMethod) you are calling something with methods (myMethod:aString), then you put #myMethod: after action: and you put a set (curly brackets) after arguments. Separate each element of the set with a period. action: #myMethod:
arguments: {param1.}
or action: #myMethod:do:
arguments: {param1. param2.}
|