comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Update text widget
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Update text widget [message #65246 is a reply to message #65244] Thu, 19 February 2009 03:33 Go to previous message
T.H. is currently offline  T.H.
Messages: 13
Registered: December 2008
Junior Member
On Feb 19, 4:25 am, titan <thunder...@inwind.it> wrote:
> Hi all,
> I'm trying to write my own first widget but probably I'm missing
> something about the event handler.
>
> I would like to create a widget text with 4 rows. these rows are
> created as insensitive and I would like to make them sensitive when
> each of these processes occur.
>
> How can I "communicate" to my widget that the process started and
> after some calculations it is finished and then update my widget???
> thanks
>
> Here is my wrong way (I tried it only for the first row)
>
> PRO my_widget_text_event, event
> WIDGET_CONTROL, event.id,GET_VALUE=text
> WIDGET_CONTROL,text1_,SET_VALUE=text1_msg
> END
>
> PRO my_widget_text, GROUP = GROUP
> base = WIDGET_BASE(TITLE = 'Processing info', XSIZE = 300, /COLUMN,
> XOFFSET=500, YOFFSET=300)
> row1 = WIDGET_BASE(base, /ROW, /FRAME)
> time_start_label = WIDGET_LABEL(row1,VALUE='Start Processing')
> time_start_txt = widget_TEXT(row1,VALUE=string(systime()))
> text1_msg='start process A'
> text1 = WIDGET_TEXT(base, YSIZE= 1, VALUE=text1_msg SENSITIVE=0,/
> FRAME, UVALUE=text1_msg)
> text2_msg = 'process A ok'
> text2 = WIDGET_TEXT(base, VALUE=text2_msg ,YSIZE = 1, /
> FRAME,SENSITIVE=0,UVALUE=text2_msg)
> text3_msg= 'Start process B'
> text3 = WIDGET_TEXT(base,VALUE=text3_msg , YSIZE = 1,/
> FRAME,SENSITIVE=0,UVALUE=text3_msg)
> text4_msg='process b ok'
> text4 = WIDGET_TEXT(base,VALUE=text4_msg ,YSIZE = 1,/
> FRAME,SENSITIVE=0,UVALUE=text4_msg)
> ; Realize the widgets:
> WIDGET_CONTROL, base, /REALIZE
> XMANAGER, 'wtext', base, GROUP_LEADER =
> GROUP,event_handler='my_widget_text_event', /NO_BLOCK
> END

I'm a bit confused about what you want this to do. Ignore me if I'm
missing something but a found two major problems with the code you
posted......

1) I'm not sure where your events are supposed to be coming from.
Since all of your text widgets are unsensitive they can't produce any
events and you have no buttons to click, slider to mover , etc.

2) In the event handler, you are using variables that you defined in
the my_widget_text but have not passed in any way to the event
handler. The event handler doesn't know what text_1 or text_1_msg
are. One common way to handle this type of issue is to create a
pointer to a structure that contains all of the information that your
event handler might need. Then set the uvalue of you top level base
to that pointer. I prefer to do this kind of stuff as an object.
This allows you to define the widgets as member data and have access
to all of them throughout the event handler.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Interpolating/gridding field reflectance spectra
Next Topic: file export to something vector-based?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 09:14:46 PDT 2025

Total time taken to generate the page: 0.32511 seconds