View previous topic :: View next topic |
Author |
Message |
Little-Acorn
Joined: 06 Jul 2008 Posts: 111 Location: San Diego
|
Posted: Wed Nov 26, 2008 2:49 am Post subject: How to make other windows close when I close the main window |
|
|
I'm running a program that puts up a "main" window (just my name for it), and then depending on what the rest of the program wants to do, puts up several other windows in other parts of the screen (not inside the main window). All of them work fine.
But when I go to the main window and click the little X in the upper right corner, that main window closes as expected, but the others don't. I wish they did. Now I have to close each of them manually, by clicking their little X's too.
How can I get those other windows to close automatically, when I click on (only) the little X in the main window?
Thanks again, all! |
|
Back to top |
|
 |
JohnCampbell
Joined: 16 Feb 2006 Posts: 2615 Location: Sydney
|
Posted: Wed Nov 26, 2008 3:41 am Post subject: |
|
|
see support > closing graphics windows, 1 Nov 08.
Paul Laidler gave an example which works well, if you know the window "name".
I guess you would test to see if you could get a handle for the possible window names that are open and then close them as they are found.
John |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8210 Location: Salford, UK
|
Posted: Wed Nov 26, 2008 8:09 am Post subject: |
|
|
If your windows are ClearWin+ windows then the trick is to use %lw for each secondary window and to programmatically set the associated control variables when you want them to close. You will find details in the help file. |
|
Back to top |
|
 |
JohnHorspool
Joined: 26 Sep 2005 Posts: 270 Location: Gloucestershire UK
|
Posted: Wed Nov 26, 2008 9:08 am Post subject: |
|
|
To do what Paul has suggested you'll first have to intercept the action of the user clicking on the little "x", using %cc to invoke a call back routine which can then run through the closure of all the windows which have made use of %lw. |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8210 Location: Salford, UK
|
Posted: Wed Nov 26, 2008 9:46 am Post subject: |
|
|
Or you can create a main window without %lw and then the last winio@ (of the main window) will not return until the window is closed. At that point you can set the %lw control variables for the other secondary windows.
I guess you will also have to call window_update@ for each control variable. |
|
Back to top |
|
 |
|