Dynamically adding and removing widgets [message #46471] |
Wed, 23 November 2005 09:40  |
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
|
|
|