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

Home » Public Forums » archive » Dynamically adding and removing widgets
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Dynamically adding and removing widgets [message #46471] Wed, 23 November 2005 09:40 Go to next message
akkiraju is currently offline  akkiraju
Messages: 3
Registered: November 2005
Junior Member
Hello Everyone,

I am trying to build a GUI using IDL widgets. I am new to IDL
widgets and I am following the conventional way. I followed the
folowing steps

1. I used GUI builder to create a GUI window creation
2. I have added a structure called 'state' to the code generated
(from generate.pro)
This looks like

state= { config_txt:config_txt,$
file_filter:file_filter,$
myDropList:myDropList,$
mask_tab : mask_tab,$
display_base: display_base,$
Shape_Weight_Txt:Shape_Weight_Txt,$
Spectral_Weight_Txt:Spectral_Weight_Txt,$
Texture_Weight_Txt:Texture_Weight_Txt }

3. Then i did
WIDGET_CONTROL,rootBase,SET_UVALUE=state. (rootBase is
my base widgets name)

4. One of my event handlers calls a procedure called
show_phenomenon

pro event_handler Event
----
WIDGET_CONTROL,Event.TOP,SET_UVALUE=state,/NO_COPY
show_phenomenon,.....,....,Event
----
end


5. In show_phenomenon I am trying add new WIDGET_DRAW component to
my existing widget_tab component.

pro show_phenomenon,........,.......,....., Event
------
------
------
widget_control,Event.Top,GET_UVALUE=state
base = widget_info(state.mask_tab,/UNAME)
mask_disp = WIDGET_DRAW(base,xsize=numCols,ysize=numRows)
widget_control,mask_disp,GET_VALUE=index
wset,index
TVIMAGE,mask
------
------
end


I get these errors
Type conversion error: Unable to convert given STRING to Long.
WIDGET_DRAW: Invalid widget identifier: 0.

and they show up on line
mask_disp = WIDGET_DRAW(base,xsize=numCols,ysize=numRows)


If i can get this to work i can go ahead to dynamically add a
specified number of widget_tab components each having a widget_draw
component in it to my base. The difficulty is that this specified
number is obtained only during the runtime and not beforehand.


I hope i have mentioned what i have tried and what i intend
to have clearly. Any hints or help on how i can work on this problem


Thank you

Bilahari, ITSC, UAH
Re: Dynamically adding and removing widgets [message #46544 is a reply to message #46471] Thu, 24 November 2005 02:26 Go to previous message
Peter Clinch is currently offline  Peter Clinch
Messages: 98
Registered: April 1996
Member
akkiraju wrote:

> I am trying to build a GUI using IDL widgets. I am new to IDL
> widgets and I am following the conventional way. I followed the
> folowing steps
>
> 1. I used GUI builder to create a GUI window creation

<snip>

Other folk have answered the technical query better than I could, but
having just trod a very similar path (including falling foul of /NO_COPY
wiping state variables while trying to create modal dialogs) I can
sympathise.

However, beyond sympathy I can pass on the following advice, which I
have had here, and from both RSI UK and RSI Central tech support: do not
use the GUI builder aside from your very first steps in Widget
programming because it makes code that is a horror show (yes, that
sentiment came from RSI's own tech support people).

Thanks to the good folk here and at RSI and a fair bit of RTFM my first
widget program is now pretty much done and dusted (with modal dialogs
too!), I /almost/ know just what's going on, and the code is a *lot*
more understandable than the mince that came out of the code generator!

Pete.
--
Peter Clinch Medical Physics IT Officer
Tel 44 1382 660111 ext. 33637 Univ. of Dundee, Ninewells Hospital
Fax 44 1382 640177 Dundee DD1 9SY Scotland UK
net p.j.clinch@dundee.ac.uk http://www.dundee.ac.uk/~pjclinch/
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: IDL objects (not object graphics) tutorial?
Next Topic: Thanks....

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

Current Time: Wed Oct 08 13:44:19 PDT 2025

Total time taken to generate the page: 0.00530 seconds