Re: control widgets [message #55116 is a reply to message #55040] |
Wed, 01 August 2007 04:15   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
payon@gmx.de writes:
> Sorry, that I couldn't answer yesterday.. Well, thanks a lot for your
> answers. I tried to do like it was described but it still doesn't
> work. Maybe I give a small example code, which makes it clearer, what
> i mean and what I want to do.
>
> My main program/widget has an event which opens a modal widget:
> pro MFiOpenData, Event
> COMMON widget_id, win2
> win2=widget_info(event.top, find_by_uname='Window2')
> openfile, group_leader=event.top
> end
>
> Now in the modal/popup widget i can upload some data, but when i want
> to leave my modal widget again, and change/return back to my main
> widget, the main widget shoud activate some green lamps on my main
> widget. I tried to do it with this Event on my modal widget:
>
> pro OKButton, Event
> COMMON widget_id, win2
> widget_control, win2, GET_VALUE=win2
> wset, win2
> green = read_bmp('green.bmp')
> tv, green, true=1
> widget_control, Event.top, /destroy
> end
>
> the problem is, that when i want to make it this way, the compiler
> says
> WIDGET_CONTROL: Class of specified widget has no value: 36
>
> So is there any other possibility how to handle with it? Because I
> still don't know how to control the main widget from my modal widget.
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.
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.
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.")
|
|
|