Re: how to exchange variable between modal dialog and the main window? [message #48064] |
Tue, 21 March 2006 06:40  |
Benjamin Hornberger
Messages: 258 Registered: March 2004
|
Senior Member |
|
|
lindows wrote:
> I'm doing a project,about image processing.But I don't know how to how
> to exchange variable between modal dialog and the main window.I can't
> find more material about the message exchanging in IDL windows.Could
> someone can help me?
> Now I use the GUIBuilder,in main window,put a button and make a
> procedure like this:
>
> pro OnPress,event
> dlggui,group_leader=event.top
> end
>
> dlggui is another procedure,with
> files:dlggui.pro,dlggui_event.pro,dlg_gui.prc.
>
> I don't know how I can transfer a variable or point A from main window
> to dlggui,I want to change the value of dlggui,in main program.
>
> thanks.
>
Transferring the variable from the main window to the dialog is easy --
just pass it as a parameter or keyword. Returning it is more tricky:
If your dialog is modal, you probably want to return the variable to the
main window at the point when the modal dialog is closed. In this case,
write your modal dialog as function which returns the variable:
http://www.dfanning.com/widget_tips/popup.html
If your dialog is not modal, i.e. you want to exchange information while
it is running in parallel with the main window, you can either send
events (widget_control, id, send_event=...) or write the dialogs (at
least the recipient of the information) as an object and call an object
method. Ask back if you need more information.
Good luck,
Benjamin
|
|
|