Simple windowed application: Difference between revisions

Added solution in J.
m (→‎{{header|Python}}: ===The same in OO manner===)
(Added solution in J.)
Line 126:
w.show()
}
 
=={{header|J}}==
 
SIMPLEAPP=: 0 : 0
pc simpleApp;
xywh 136 8 44 12;cc inc button;cn "Click me";
xywh 136 23 44 12;cc cancel button;cn "Cancel";
xywh 7 10 115 11;cc shownText static;cn "There have been no clicks yet.";
pas 6 6;pcenter;
rem form end;
)
simpleApp_run=: 3 : 0
wd SIMPLEAPP
simpleApp_accum=: 0 NB. initialize accumulator
wd 'pshow;'
)
simpleApp_close=: 3 : 0
wd'pclose'
)
simpleApp_cancel_button=: 3 : 0
simpleApp_close i.0 NB. see Note 1
)
simpleApp_inc_button=: 3 : 0
wd 'set shownText *','Button-use count: ',": simpleApp_accum=: >: simpleApp_accum
)
simpleApp_run i.0 NB. see Note 1
Note 1: Two lines, marked with comment pointing to this note, normally would end with two single-quotes. Here i.0 is used; it is a synonym for null. This technique was used to compensate for how adjacent quotes are processed by the Rosetta Code wiki.
 
=={{header|IDL}}==
Anonymous user