On Mar 10, 12:30 pm, titan <thunder...@inwind.it> wrote:
> Hi all,
> I'm trying to write a simple widget which permits to insert 2 values
> and check if the min value is less than the max value. If not a
> message error appears. My problem is that once the "quit" button of
> this error message is pressed I'm not able to re-open the first widget
> in order to correct the values inserted.
> How can I handle this aspect?
>
> thanks
>
> here you can find the code:
>
> PRO quit_button_event, event
> WIDGET_CONTROL,event.top,/DESTROY ;
> END
>
> input_param = WIDGET_AUTO_BASE(title='Input data range')
>
> p1 = WIDGET_PARAM(input_param, /auto_manage, dt=4, field=3,
> DEFAULT='7.5',$
> prompt='minimum std dev of heights value',
> uvalue='p1')
>
> p2 = WIDGET_PARAM(input_param, /auto_manage, dt=4, field=3,
> DEFAULT='4.5',$
> prompt='maximum std dev of heights value',
> uvalue='p2')
> result=AUTO_WID_MNG(input_param)
> IF (result.accept eq 0) THEN return
>
> min_val = result.p1
> max_val = result.p2
>
> IF (min_val GT max_val) THEN BEGIN
> base_err = WIDGET_BASE(TITLE = 'INPUT ERROR info', XSIZE = 500, /
> COLUMN, XOFFSET=500, YOFFSET=300)
> row_err = WIDGET_BASE(base_err, /ROW,/FRAME)
> err_label = WIDGET_LABEL(row_err,VALUE='ERROR MESSAGE ',/
> DYNAMIC_RESIZE)
> err_msg = widget_TEXT(row_err,VALUE='Please check if the
> maximum/minimum order inserted is correct',XSIZE=60)
> row_quit_button = WIDGET_BASE(base_err, /ROW,/FRAME, /
> ALIGN_CENTER)
> quit_button= WIDGET_BUTTON(row_quit_button, VALUE='QUIT',
> UVALUE='Quit', XSIZE = 100,/ALIGN_CENTER)
> WIDGET_CONTROL, base_err, /REALIZE
> XMANAGER, 'wid_err',
> base_err,event_handler='quit_button_event'
> ENDIF
> end
If nothing else you can always have your error message say "You need
to fix your values" or something to that effect, then just redisplay
the original widget, check it again, and repeat as necessary...
|