control widgets [message #55040] |
Tue, 31 July 2007 09:58  |
payon
Messages: 11 Registered: July 2007
|
Junior Member |
|
|
Hello,
i have still one problem. But I think this really seems to be a little
bit complicated (also for me to exlpain, but i try to).
When i'm operating in my main_base, then it's not a problem to get the
ID's of the separate widgets and to control them over widget_control.
But how is it when I'm in a modal widget?
Because in my modal widget I also wanted to make an event which can
control widgets from my main base. I really searched for a solution,
but I found nothing what could explain how to do it.
So the exact problem is, my modal widget opens when a button is
pressed on my main base (Ope File).
Then I can upload the files with my modal widget. But when they were
uploaded and the modal widget was destroyed, they should also be shown
in a draw widget on the main base. So the process should be induced
with the destroyEvent
The problem i have is, that I can only handle with the variable and
transfer it through common block or uvalue etc. And then create a new
Event on my main_base which opens the variable. but I wanted to open
it on my main_base from my Modul Widget. Is it possible? I just read
about how to transfer variables through different widgets, but not how
to control them , especially with the procedure widget_control. Maybe
you can help me.
martin
|
|
|
Re: control widgets [message #55110 is a reply to message #55040] |
Wed, 01 August 2007 05:48  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
payon@gmx.de writes:
> 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?
Well, you may be right. You certainly can't send events
to another TLB widget from a modal widget, which would
be the normal method of communicating in widget programs.
I don't know if you can control other widgets directly
from a modal widget. I've never tried it. But it wouldn't
surprise me to find it's not allowed, since by definition
the other widgets are not suppose to be "active" during
that time.
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.")
|
|
|
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.")
|
|
|
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.")
|
|
|
Re: control widgets [message #55122 is a reply to message #55040] |
Wed, 01 August 2007 01:06  |
payon
Messages: 11 Registered: July 2007
|
Junior Member |
|
|
On 31 Jul., 20:17, David Fanning <da...@dfanning.com> wrote:
> pa...@gmx.de writes:
>> So the exact problem is, my modal widget opens when a button is
>> pressed on my main base (Ope File).
>> Then I can upload the files with my modal widget. But when they were
>> uploaded and the modal widget was destroyed, they should also be shown
>> in a draw widget on the main base. So the process should be induced
>> with the destroyEvent
>
> I think you want your modal widget to be a "pop-up dialog widget"
> that collects the filenames and returns them to your main program,
> where you can easily display them wherever you want them. (Although
> I doubt you really mean in a draw widget. Perhaps a text or list
> widget.)
>
> Here is how to create a modal pop-up widget:
>
> http://www.dfanning.com/widget_tips/popup.html
>
> Cheers,
>
> David
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.dfanning.com/
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.
greetings
martin
|
|
|
Re: control widgets [message #55135 is a reply to message #55040] |
Tue, 31 July 2007 11:17  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
payon@gmx.de writes:
> So the exact problem is, my modal widget opens when a button is
> pressed on my main base (Ope File).
> Then I can upload the files with my modal widget. But when they were
> uploaded and the modal widget was destroyed, they should also be shown
> in a draw widget on the main base. So the process should be induced
> with the destroyEvent
I think you want your modal widget to be a "pop-up dialog widget"
that collects the filenames and returns them to your main program,
where you can easily display them wherever you want them. (Although
I doubt you really mean in a draw widget. Perhaps a text or list
widget.)
Here is how to create a modal pop-up widget:
http://www.dfanning.com/widget_tips/popup.html
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|