forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Close all windows and terminate

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
eric_carwardine



Joined: 13 Jun 2009
Posts: 70
Location: Perth, Western Australia

PostPosted: Tue Jul 24, 2012 9:43 am    Post subject: Close all windows and terminate Reply with quote

Hallo from Perth, Western Australia Very Happy

The parent window is open, and also open is one child window. Is there a 'button' I can install on the child window which, when clicked, will close ALL windows and terminate the program? A sort-of ClearWin crash-dive Smile

Eric
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Wilfried Linder



Joined: 14 Nov 2007
Posts: 314
Location: Düsseldorf, Germany

PostPosted: Tue Jul 24, 2012 10:38 am    Post subject: Reply with quote

Hi Eric,

a return value of zero will close the window. Try for instance something like this:

Code:
      winapp

      program test

      INCLUDE <WINDOWS.INS>

      external    AAA
      integer*4   j,flag

      common  /win_handle/  flag

      flag = 1

      j = winio@('%ca[Test]%mn[Next window,Exit]',AAA,'EXIT')
      end

cccccc==================================================================ccc

      integer function AAA()

      INCLUDE <WINDOWS.INS>

      external       close_all
      integer*4      j,flag

      common  /win_handle/  flag

      j = winio@('%ca[Child window]%ff%nlchild window%ff%nl&')
      j = winio@('%cn%^bt[Close this window]&','EXIT')
      j = winio@('%^bt[Close all windows]',close_all)

      AAA = flag   ! if flag = 0, all windows will be closed
      end

cccccc==================================================================ccc

      integer function close_all()

      integer*4      flag
      common  /win_handle/  flag

      flag = 0
      close_all = 0
      end


Regards - Wilfried
Back to top
View user's profile Send private message
eric_carwardine



Joined: 13 Jun 2009
Posts: 70
Location: Perth, Western Australia

PostPosted: Tue Jul 24, 2012 2:07 pm    Post subject: Reply with quote

Clicking on the [Close all windows] button invokes the close_all function which returns with a zero value which closes the child window, AAA.

But, unbeknown to the child, it now returns a zero value to its parent, courtesy of flag being set to zero by close_all. Horrified, entire family now disappear into the Big Bit Bin in the Sky!

No wonder we learn to distrust our offspring Very Happy

The elegance of the algorithm rather mitigates its gruesomeness Very Happy Thank you for making the effort to respond, Wilfried. It is much appreciated Very Happy
Back to top
View user's profile Send private message Send e-mail Visit poster's website
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Wed Jul 25, 2012 10:43 am    Post subject: Reply with quote

Eric and Wilfried,

It is OK if the big red button resides in the ultimate child window. Then one can cascade back all the way up the list to the ultimate ancestor, closing as you go with zero return codes

If the big red button is in the ultimate ancestor window, then getting the descendants to close is a slightly more difficult problem.

The use of %lw[owned] suggests itself here, (along with other varieties of %lw to give a simple closure control) or by having the forethought to get each windows handle using %hw so that the decendants are all terminated by an explicit close window call DestroyWindow (in the GUI).

If you don't have the handles, you are into more complex territory ...

Eddie
Back to top
View user's profile Send private message
eric_carwardine



Joined: 13 Jun 2009
Posts: 70
Location: Perth, Western Australia

PostPosted: Wed Jul 25, 2012 2:01 pm    Post subject: Reply with quote

G'day, Eddie!

Wonderful to hear from you Very Happy

Many thanks for the elaboration regarding handles. It'll come in handy if the Big Red Button has to migrate.

We're wondering what to label the Button. 'Apocalypse' has been suggested Very Happy

Eric
Back to top
View user's profile Send private message Send e-mail Visit poster's website
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Thu Jul 26, 2012 6:30 pm    Post subject: Reply with quote

I suggest Kronos for the label on a button that devours its children, and maybe Oedipus for one that assassinates its parent (but only one!).

Defenestrate sounds that it could have the right meaning, but although one or two folks have tried to redefine it as ridding oneself of Windows (as in installing Linux), it really means to chuck someone out of a window!

Shut up shop? Curtains (I like the dual meaning) ?

The big red button iconography is probably best, as a picture is worth a 1000 words ...

Eddie
Back to top
View user's profile Send private message
eric_carwardine



Joined: 13 Jun 2009
Posts: 70
Location: Perth, Western Australia

PostPosted: Fri Jul 27, 2012 2:23 pm    Post subject: Reply with quote

At the moment I've settled for 'Save & Exit' Very Happy
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+ All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group