The .success() method above could only deliver a fixed string
‘Hello again’ to the
message PARAGRAPH gadget. The great advantage of methods is that you can pass variables as arguments to the method, so it can be used more generally, for example as the callback to several gadgets.
When the OK button is pressed the
Okcall action will invoke the
success() method, passing to it the
message paragraph gadget as
!output, the message text
‘Hello again’ as
!message and the text input field gadget
capture as
!input. The method will do just what it did before.
When clicked, the Restart button‘s callback will execute and set the
message paragraph gadget to read ‘
Hello world’ and clear the
capture text field, thus restoring the form to its state when it was displayed for the very first time.
it would set the value ‘Hello world’ into the
capture text input field and clear the contents of the
message PARAGRAPH gadget. Not what you need here perhaps, but you can see how versatile methods can be!