Re: control widgets [message #55115 is a reply to message #55040] |
Wed, 01 August 2007 04:55   |
payon
Messages: 11 Registered: July 2007
|
Junior Member |
|
|
Well, it still seems to me to be an awkward way to write
> a program. If you just made your modal widget OPENFILE
> a function that returned the files you were interested in,
> then you wouldn't have to leave your MFiOpenData event
> handler. When you get the files back, you set your draw
> widget green. All action stays inside the widget group
> itself.
- this is a very good point. You're right. It's also possible to set
the draw widget
green, after the modal widget was destroyed provided that i'm still
inside of the event!
I will test it and answer! But i think , this should be a good
solution.
> But this really isn't your problem. Your problem is that
> win2 isn't the draw widget you think it is. It is a base
> widget. And base widgets don't have values. In other words,
> this line:
>
> win2=widget_info(event.top, find_by_uname='Window2')
>
> is not finding the correct widget.
- Well here it's really a little bit more complicated.
Let me explain. When i start the program, then i let the draw widgets
red.
pro BaseOnTop, wWidget
win2=widget_info(event.top, find_by_uname='Window2')
widget_control, win2, GET_VALUE=win2
wset, win2
a=read_bmp('red.bmp')
tv, a, true=1
end
this works fine, and here he also finds the widget id of the draw
widget "Window2".
But if i want to pass this ID to my modal widget as here with COMMON
widget_id, win2
pro MFiOpenData, Event
COMMON widget_id, win2
win2=widget_info(event.top, find_by_uname='Window2')
; openfile, group_leader=event.top <--- without closing!
end
and then for example control the Window2 draw widget which is placed
on my main widget or maybe better say groupleader,
then the modal widget can't communicate with the draw widget anymore,
even if the ID is passed to the modal widget.
I think this is a problem of multi tasking. Please correct me, if I'm
wrong. But I suppose that IDL cannot control the main widget via
widget_control throuh a modal widget.
Let me tell another example. Let's assume there are two widgets. The
one is the main base and the groupleader, the second one is a modal
widget. So in the one window i have three buttons in the other three
lights.
Is it possible (without closing the modal widget) to press on buttons
in the modal widget and with pressing on them to change the color of
the lights in the main window?
> Cheers,
>
> David
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.dfanning.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|