lloyd@evilprofessor.co.uk (Lloyd Watkin) wrote in message news:<c3f97ff.0410250640.61eab55e@posting.google.com>...
> Hi all,
>
> In advance, thanks for all the wonderful help that everyone always
> passes my way.
>
> I've started to venture into using CW_FORM to make quick forms for a
> program I am writing. I think I have it almost done. I have a couple
> of problems that I need to fix first though.
>
> I have two text fields into which I want to place values that the user
> can edit if they desire. Have placed the SET_VALUE keywords in, but am
> still not getting any values printed there! Any ideas (have posted the
> SHORT code at the end of this post).
>
> Also if anyone could help on getting my checkboxes to line up that
> would be great too.
>
> Thanks
>
> Lloyd Watkin
Hi Lloyd,
I've re-written your code to use CW_BGROUP (which seems to have a
slight
bug of its own), however I think the code is clearer and easier than
that
god-awful Cw_Form mush...
Andrew
Pro test_species_event,ev
widget_control,ev.id,Get_Uvalue = Uvalue
widget_control,ev.id,Get_Value = Value
Case Uvalue Of
'SPECIES SELECTION' : $
Begin
If ev.value EQ ' ' Then Begin
; dummy spacer button - now de-sensitised
return
Endif Else begin
print,'Selected species ' + ev.value
Endelse
End
'MAX STEP SIZE' : $
Begin
max_step_size = ev.value
print,'New Max Step Size = ',max_step_size
End
'MIN STEP SIZE' : $
Begin
min_step_size = ev.value
print,'New Min Step Size = ',min_step_size
End
'OK' : $
Begin
Widget_control,ev.top,/Destroy
End
'CANCEL' : $
Begin
Widget_control,ev.top,/Destroy
End
ELSE : Begin
Message,'Invalid Uvalue : ' + string(uvalue)
End
End ; of Case
End
;........................................................... ......................
pro test_species
; Revamp of Lloyd Watkins post. A.D. Cool DSTO Adelaide, Oz
max_step = 1.0e-1
min_step = 1.0e-9
species1 = ['H2O','CO2','O3','N2O','CO','CH4','O2']
species2 = ['NO','SO2','NO2','NH3','HNO3','OH','HF']
species3 = ['HCl','HBr','HI','ClO','OCS','H2CO','HOCl']
species4 = ['N2', 'HCN', 'CH3Cl', 'H2O2', 'C2H2', 'C2H6', 'PH3']
species5 = ['COF2','SF6','H2S','HCOOH','HO2','O','CIONO2']
;species6 = ['NO+','HOBr','C2H4','CH3OH']
; Hmmm. Needs padding out with dummy buttons - incorrect behaviour -
bug?
; I would have thought that the first 5 columns should all fill up
with
; 7 buttons?
species6 = ['NO+','HOBr','C2H4','CH3OH',' ',' ',' ']
btn_vals = [species1,species2,species3,species4,species5,species6]
TLB = Widget_base(/col,Title='Species test')
base1 = Widget_base(TLB,/row,/frame)
btn_grp = Cw_BGROUP(base1,btn_vals,Button_uvalue=btn_vals,col=6,/NONEX CLUSIVE,$
IDS =
species_ids,/NO_Release,Uvalue='SPECIES SELECTION')
base2 = Widget_base(TLB,/Col,/Frame)
Max_step_fd = $
CW_field(base2,/Return_events,/Floating,Title='Maximum Step Size',$
Value = max_step,Uvalue='MAX STEP SIZE')
Min_step_fd = $
CW_field(base2,/Return_events,/Floating,Title='Minimum Step Size',$
Value = min_step,Uvalue='MIN STEP SIZE')
base3 = Widget_base(TLB,/row,/Frame)
OK_id = Widget_Button(base3,Value='OK',Uvalue='OK')
Cancel_id = Widget_Button(base3,Value='Cancel',Uvalue='CANCEL')
widget_Control,tlb,/real
; de-sensitise dummy spacer buttons - possible bug in layout of
CW_BGROUP?
widget_control,species_ids(39),Sensitive=0
widget_control,species_ids(40),Sensitive=0
widget_control,species_ids(41),Sensitive=0
Xmanager, 'test_species', TLB
End
|