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 a ClearWin window

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



Joined: 31 Aug 2007
Posts: 66

PostPosted: Mon Feb 01, 2010 4:17 am    Post subject: closing a ClearWin window Reply with quote

I open a ClearWin window using

nTHandle = Create_Window@ ( Caption,
1 n_TextW_posnX, n_TextW_posnY,
2 n_TextW_szeX, n_TextW_szeY )

The created window has the usual minimise, resize and close buttons at the top right.

I close the window using "call Destroy_Window@ ( nTHandle )", in response to a user command.

However, the user can also close the window using the "close" button.

Does your compiler set or change a flag somewhere that I can interrogate to check whether the window has been closed in this way? Or do I have to use %cw and %cc and set my own flag?

Norm Campbell
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Mon Feb 01, 2010 9:28 am    Post subject: Reply with quote

There is no flag a such.

One way to see if a window is still open is to use the value returned by create_window@ (which is the Windows handle HWND for the window).

FindWindow("SalfordClass", 0) will return this handle if the window is still open otherwise it will return zero. This assumes you only have one ClearWin window open at a time otherwise you will need to use FindWindowEx. FindWindow and FindWindowEx are Windows API functions.
Back to top
View user's profile Send private message AIM Address
Norm.Campbell



Joined: 31 Aug 2007
Posts: 66

PostPosted: Mon Feb 01, 2010 1:33 pm    Post subject: Reply with quote

Thanks, Paul, for the prompt reply.

You'll see from the code that I've pasted below that I'm a very old-fashioned programmer (a statistician who still writes Fortran code) -- I even occasionally use "go to"s when I'm coding, if I think that it makes the logic easier to follow -- and I don't have any experience with accessing Windows API functions (not explicitly, anyway).

Is it asking too much to have you spend a couple of minutes to make the specific changes that are needed -- eg the appropriate "include" statement; any "external" statement; and the form of the call to FindWindow at statement 200 -- so that the code will run.

Many thanks

Norm



subroutine v3D_query_example ( )

use mod_1_control

include <windows.ins>

integer*2 n_TextW_szeX, n_TextW_szeY, n_TextW_posnX, n_TextW_posnY

n_TextW_szeX = 215
n_TextW_szeY = 150

n_TextW_posnX = m_wndw_1_width

n_TextW_posnY = m_wndw_1_height

c m_wndw_1_width, *.height, wndw_Caption set in mod_1_control

nTHandle = Create_Window@ ( wndw_Caption,
1 n_TextW_posnX, n_TextW_posnY,
2 n_TextW_szeX, n_TextW_szeY )

call Open_to_Window@ ( 8, nTHandle )

c motionpassive ( mouse_X, mouse_Y ) used to update mouse X,Y

nCmse_X = mouse_X
nCmse_Y = mouse_Y

100 call yield_program_control@ ( y_temporarily )

nmse_X = mouse_X
nmse_Y = mouse_Y

if ( nmse_X .ne. nCmse_X .or. nmse_Y .ne. nCmse_Y ) go to 200

nCmse_X = nmse_X
nCmse_Y = nmse_Y

go to 100

200 if ( nmse_X .ge. m_wndw_1_width - 15 .and. nmse_Y .le. 15 )
1 go to 300

c exit loop if mouse in top-right corner -- pseudo close button

c want to change code to monitor window status to "go to 300" if nTHandle window is closed

nCmse_X = nmse_X
nCmse_Y = nmse_Y

X_val = nmse_X

Y_val = nmse_Y

call Clear_Window@ ( nTHandle )

write ( 8, '( a, '' : '', i8 )' ) 'X value', nmse_X

write ( 8, '( a, '' : '', i8 )' ) 'Y value', nmse_Y

go to 100

300 call Destroy_Window@ ( nTHandle )

nTHandle = 0

return
end
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Mon Feb 01, 2010 9:15 pm    Post subject: Reply with quote

Code:
WINAPP
INCLUDE <windows.ins>
STDCALL MyFindWindow 'FindWindowA' (STRING,VAL):INTEGER*4
nTHandle = Create_Window@("Caption",0,0,200,200)
CALL Open_to_Window@(8,nTHandle)
!Peocessing goes here
IF(MyFindWindow("SalfordClass", 0) == nTHandle) WRITE(8,*) "This window is still open"
END
Back to top
View user's profile Send private message AIM Address
Norm.Campbell



Joined: 31 Aug 2007
Posts: 66

PostPosted: Tue Feb 02, 2010 12:44 am    Post subject: Reply with quote

Many thanks yet again, Paul.

There is no way that I could ever have worked that out by myself.

Norm
Back to top
View user's profile Send private message
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