NB.cities demo -  windows program

CITIES=: 0 : 0
pc cities closeok;pn "City Distances";
xywh 9 9 20 8;cc s0 static;cn "From:";
xywh 35 8 83 100;cc clist combolist ws_vscroll ws_border;
xywh 9 26 46 9;cc Kilometers radiobutton;
xywh 9 38 40 9;cc Miles radiobutton group;
xywh 6 21 54 28;cc dist groupbox;cn "";
xywh 70 26 48 9;cc Alphabetic radiobutton;
xywh 70 38 53 9;cc Distance radiobutton group;cn "By Distance";
xywh 66 21 62 28;cc sort groupbox;cn "";
xywh 137 8 34 12;cc ok button;cn "OK";
xywh 137 23 34 12;cc cancel button;cn "Cancel";
pas 6 6;pcenter;
rem form end;
)

cities_run=: 3 : 0
cityread''
wd CITIES
wd 'set clist *',;BNAMES,&.>LF
wd 'setselect clist ',":(#BNAMES)|.BNAMES i. <'Antwerp'
wd 'set Kilometers 1'
wd 'set Alphabetic 1'	
wd 'pshow'
)

cities_cancel_button=: wd bind 'pclose'

j=. 'Cities Demo',LF,LF,'J Release 3 for Windows',LF,LF
j=. j,'Strand Software',LF
j=. j,'19235 Covington Court',LF,'Shorewood, Minnesota 55331',LF
j=. j,'Tel:  (612) 470-7345',LF,'Fax: (612) 470-9202'
cities_about_button=: wdinfo bind j

cities_ok_button=: 3 : 0
ndx=. ".clist_select
if. 0=#ndx do.
  wdinfo 'City not found'
  return.
end.
clistmsk=. ndx ~: i.#BNAMES
miles=. ".Miles
bydist=. ".Distance
txt=. cityfmt miles,bydist,ndx
hdr=. ' from ',(>ndx{BNAMES),':'
hdr=. (>miles{'Kilometers';'Miles'),hdr
'City Distances' wdview hdr;txt
)

cities_clist_button=: cities_ok_button
cities_enter=: cities_ok_button

cities=: cities_run
