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 

Closing winapp Output window

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



Joined: 21 Jan 2011
Posts: 65
Location: Leimen, Germany

PostPosted: Thu Nov 24, 2011 6:57 pm    Post subject: Closing winapp Output window Reply with quote

Hello Forum,
winapp is creating a white window called "Output", where all the print * lines show up. However, this window does not close automatically neither at END nor STOP. This may be fine for inspection of the test prints, but I want an automatic close and disappear of the window at end of the run.
How can this be achieved?
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7923
Location: Salford, UK

PostPosted: Fri Nov 25, 2011 6:52 pm    Post subject: Reply with quote

The help file says use create_window@ and destroy_window@.

Code:
winapp
program main
include <windows.ins>
ih = create_window@("Output",100,100,400,400)
call open_to_window@(7, ih)
write(7,*) "Hello World"
ic = win_getchar@(ih)
call destroy_window@(ih);
end
Back to top
View user's profile Send private message AIM Address
JohnCampbell



Joined: 16 Feb 2006
Posts: 2554
Location: Sydney

PostPosted: Sat Nov 26, 2011 12:16 pm    Post subject: Reply with quote

Typically, if you do not open the OUTPUT window explicitly, you can still close it with the following code example
Code:
      i = winio@  ('%mn[[E&xit]]&',   exit_func)

integer*4 function exit_func()
!
    call close_output_window
!
    exit_func = 0    !   Setting the return value to zero will exit the program.

end function exit_func

     subroutine close_output_window
!
      INCLUDE <windows.ins>
!
      integer*4 hwnd
      logical   L
!
!   Get the handle for the "Output" window
      hwnd = FindWindow("SalfordClass", "Output")
      write (98,*) hwnd,' = FindWindow("SalfordClass", "Output")'
      if (hwnd < 1) return
      L    = DestroyWindow (hwnd)
      write (98,*) L,   ' = DestroyWindow(hwnd)'
!
      end subroutine close_output_window
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7923
Location: Salford, UK

PostPosted: Sun Nov 27, 2011 9:23 am    Post subject: Reply with quote

These two approaches are compatible and equivalent.

destroy_window@ calls DestroyWindow and the handle returned by create_window@ is the same as the one that is found using FindWindow.

You can use either approach or mix/merge at will.
Back to top
View user's profile Send private message AIM Address
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