Re: dynamically change the layout of widget [message #38655 is a reply to message #38527] |
Thu, 18 March 2004 05:24   |
robert.dimeo
Messages: 42 Registered: November 2001
|
Member |
|
|
Try this...
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
pro ev_handler,event
uname = widget_info(event.id,/uname)
case uname of
'button_1': $
begin
but_b = widget_button(event.top, $
value = 'Now Press Me', $
uname = 'button_2')
end
'button_2': $
begin
widget_control,event.id,/destroy
end
'quit': widget_control,event.top,/destroy
else:
endcase
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
pro dynamic_widget
tlb = widget_base(/col,/tlb_frame_attr)
but_a = widget_button(tlb,value = 'Press Me', $
uname = 'button_1')
quit_button = widget_button(tlb,value = 'Quit', $
uname = 'quit')
widget_control,tlb,/realize
xmanager,'dynamic_widget',tlb,/no_block, $
event_handler = 'ev_handler'
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Hope this helps,
Rob
Tianle Yuan <tianle@rac3.wam.umd.edu> wrote in message news:<c39u52$spn$1@grapevine.wam.umd.edu>...
> Hi,there
>
> Here's my question: I have set up a widget base and layout. There's a
>
> button,But_A, in that widget base. For it,I creat a event handler, pro_A.
>
> What I'm wishing to do is when I click the button and the event handler is
>
> called, I will create another widget in the widget base I set up before.
>
> How can I realize it ,or is it possible?
>
> Thanks a lot.
|
|
|