Anyone who can write an APL function should be able to host it on the web.™
Rendered webpage |
APL code |
:Class ejButtonAdvanced : MiPageSample
⍝ Control:: _SF.ejButton
⍝ Description:: Toggle availablility of one button with another
∇ Compose
:Access Public
⍝ Start a counter to count the number of times the button is clicked
Count←0
⍝ The first button (b1)
b1←'btn1'Add _.ejButton'Toggle its state →'
b1.On'click' 'myCallback'
⍝ The second button (b2)
b2←Add _.ejButton'Show message'
b2.id←'btn2'
'type' 'enabled'b2.Set'ej.ButtonType.Button'_false
b2.On'click' 'myCallback'
⍝ A place to write the message
Add _.br
'output'Add _.div
∇
∇ r←myCallback
:Access public
⍝ This callback simply flips b2's state when b1 is clicked
:If 'btn1'≡_what
r←'enabled'b2.Update⊃_true _false~b2.GetOption'enabled'
r,←'#output'Replace''
:Else
Count+←1
r←'#output'Replace⍕'You pressed the right button',Count,'times.'
:EndIf
∇
:EndClass