Jump to content

User input/Graphical: Difference between revisions

simplified previous example
(A J language example of GUI)
(simplified previous example)
Line 248:
 
=={{header|J}}==
A revision of the script posted at the [http://wwwrosettacode.jsoftware.comorg/jwikiwiki/Grid/ExamplesSimple_Windowed_Application#griddemo2.ijs J wikiSimple_Windowed_Application]
 
<lang j>
GDEMOSIMPLEGUI=: 0 : 0
quote =: ''''&,@(,&'''')
pc simpleGui;
assign=: [,'=:',quote@]
xywh 6136 639 9844 12;cc savegridclose button;cn "Save after <Return>Close";
execute=: ".@: assign &":&>/ NB. see gdemo_savegrid_button
xywh 0 14 60 11;cc IntegerLabel static ss_right;cn "Enter an integer";
xywh 65 13 60 12;cc integer edit;
require 'jzgrid'
xywh 0 39 60 11;cc TextLabel static ss_right;cn "Enter text";
xywh 64 38 60 12;cc text edit;
cocurrent 'myform'
pas 6 6;pcenter;
rem form end;
CELLDATA=: _2]\4{.'String';'Number';' ';75000
)
 
GDEMO=: 0 : 0
simpleGui_run=: 3 : 0
pc gdemo;
wd SIMPLEGUI
xywh 6 6 98 12;cc savegrid button;cn "Save after <Return>";
simpleGui_integer=: '75000' NB. initialize integer
xywh 0 25 200 100;cc grid isigraph rightmove bottommove;
wd 'set integer *', ": simpleGui_integer
pas 0 0;
wd 'pshow;'
rem form end;
)
 
gdemo_runsimpleGui_close=: 3 : 0
simpleGui_text =: text
wd GDEMO
try.
grid=: '' conew 'jzgrid'
simpleGui_integer =: ". integer
show__grid 'celldata'
catch.
wd 'pshow'
wdinfo 'simpleGui_integer is Not a number'
)
end.
wd 'pclose'
create=: gdemo_run
)
 
destroy=: 3 : 0
simpleGui_close_button=: 3 : 0
destroy__grid''
simpleGui_close''
wd 'pclose'
)
codestroy''
 
)
simpleGui_cancel =: simpleGui_close
 
gdemo_savegrid_button=: 3 : 0
simpleGui_run''
GRID_base_=: CELLDATA__grid
 
execute_base_ GRID_base_
 
)
gdemo_close=: destroy
create''
</lang>
 
After you enter values into the graphical display and click "SaveClose", then you
can bring focus to the .ijx window to see results. IfThen you didcan nottype change"simpleGui_integer the'return'" namesand "StringsimpleGui_text 'return'" into the .ijx window to verify their values.
and "Number", then you can type "String 'return'" and "Number 'return'" into
the .ijx window to verify their values. If you changed the names, then the
values will be at the revised names.
 
=={{header|Java}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.