On Mon, 25 Oct 2004 07:40:26 -0700, Lloyd Watkin wrote:
> 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
>
> -----------------------------------------
> pro test3
>
> max_step = 1.0e-1
> min_step = 1.0e-9
>
> desc = [ $
> '0, LABEL, Choose which species to vary:, CENTER', $
> '1, BASE,, COLUMN=7, FRAME', $
> '0, BUTTON, H2O|CO2|O3|N2O|CO|CH4|O2,' $
> + 'ROW, TAG=species1', $
> '0, BUTTON, NO|SO2|NO2|NH3|HNO3|OH|HF,' $
> + 'ROW, TAG=species2', $
> '0, BUTTON, HCl|HBr|HI|ClO|OCS|H2CO|HOCl,' $
> + 'ROW, TAG=species3', $
> '0, BUTTON, N2|HCN|CH3Cl|H2O2|C2H2|C2H6|PH3,' $
> + 'ROW, TAG=species4', $
> '0, BUTTON, COF2|SF6|H2S|HCOOH|HO2|O|ClONO2,' $
> + 'ROW, TAG=species5', $
> '0, BUTTON, NO+|HOBr|C2H4|CH3OH,width=200,' $
> + 'ROW, TAG=species6', $
> '0, TEXT, , LABEL_LEFT=Maximum step size:,SET_VALUE=max_step,
> WIDTH=20' $
> + 'TAG=maxstep', $
> '0, INTEGER, 0, LABEL_LEFT=Minimum step size:,SET_VALUE=min_step,
> WIDTH=20, TAG=minstep', $
> '1, BASE,, ROW', $
> '0, BUTTON, OK, QUIT,CENTER,' $
> + 'TAG=OK', $
> '2, BUTTON, Cancel, QUIT, CENTER']
>
> a = CW_FORM(desc, /COLUMN)
>
> ;HELP, /STRUCTURE, a
>
> if (a.ok EQ 0) then retall ;User has cancelled the fit
>
> species = [a.species1,a.species2,a.species3,a.species4,a.species5,a.sp ecies6]
> print, species
> max_step = a.maxstep
> min_step = a.minstep
> print, minstep, maxstep
> stop
> end
Lloyd,
Without access to idl right now but access to some of my old programs that
use cw_form so I might be wrong but here goes:
At your initialization for the text field:
> '0, TEXT, , LABEL_LEFT=Maximum step size:,SET_VALUE=max_step,
> WIDTH=20' $
> + 'TAG=maxstep', $
You need a comma (,) following the WIDTH=20
Also I would not try to set the value in this step (don't even know if
that works with cw_form). I would however put a default value in the blank
value field '0, TEXT, **Here**, Label_left=... And then do the following:
WIDGET_CONTROL, a, set_value={species1:0, species2:0, species3:0, $
species4:0, species5:0, max_step:maxstep, minstep:min_step, ...}
after the a = cw_form() step. Not sure what the quit/ok button setting
should be hence the ... This will initialize all of the fields/droplists
to a default of the first element and set your max and min steps.
Hope this helps. In idl 5.3 or so I found that cw_form has a few bugs
especially relating to droplist setting. I haven't used it under 5.5 or
6.0 to see if they fixed the bug (I reported it then). My old code uses a
modified version of cw_form which I could send you if you find problems
with the droplists.
Andy
|