Re: re-create a widget [message #70079] |
Sat, 13 March 2010 07:22  |
Robert Moss, PhD
Messages: 29 Registered: November 2006
|
Junior Member |
|
|
On Mar 11, 6:07 pm, titan <thunder...@inwind.it> wrote:
> On Mar 11, 4:55 am, "Jeff N." <jeffnettles4...@gmail.com> wrote:
>
>
>
>> 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...
>
> Ehm the fact is that I'm having problem with how to redisplay the
> original widget..
> Could you please explain what you mean?
> I'm wondering if the problem is related to the fact that I used an
> AUTO_MANAGE widget..
> thanks
Yes, it is because you are using an auto managed widget. I advise
using a modal widget and skipping the auto_manage bits.
r
|
|
|