close a child window in quickwin

close a child window in quickwin

i started my program in quickwin and i tought it was a very practical interface. Now im having much troubles like this. I want to close a child window, but i see the X button to close is disabled, so how can i close this window?


10 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

i can close it by the close(unit), funtion, but i'd like to know how to enable the X to close.


kooka wrote:

i can close it by the close(unit), funtion, but i'd like to know how to enable the X to close.

I'm having the same issue in my program that I just started, and I'm really new to quickwin. Would you happen to have been able to find a way to enable the X on the child window?

Assuming you can find the child window's handle, you can then call the WinAPI function SetWindowLong() which will enable you to change the window's style attributes.  You can thus modify the child window to have a visible title bar with system controls including a cancel button.  SetWindowLong() is directly accessible from IVF by including IFWIN and IFWINTY; see the discussion at MSDN for details on the various argument values for GWL_STYLE.

@Paul the [x] is already there it is either disabled or the quickwin handler traps and disgards user action on it. HAnven'y seen any function in the sdk to enable/diasable so I am ussuming it is the latter.

@Adrian This will be possible to do but if you area newbie to the system it will not be that 'easy' to do.

(Re)setting a window's attributes with SetWindowLong() will supercede the attributes set (by Quickwin?) when the window was created, that's the entire point of my suggestion.  The cancel function is handled at the opsys level and will definitely close the window, whether or not the window's proc function (hidden within Quickwin) has specific code for that message.

I guess something like:

subroutine test_SetWindowLong_quickwin
   use ifwin, only : SetWindowLong, long, handle, WS_SYSMENU, WS_CAPTION, GWL_STYLE, WS_MAXIMIZEBOX, WS_MINIMIZEBOX
   implicit none
   integer(long)     :: iret,iflg
   integer(handle) :: hWnd
   integer(4)          :: iunt
   hWnd=GETHWNDQQ(iunt) !get the handle for quickwin child window iunt
   ! iflg = iany([WS_SYSMENU,WS_CAPTION]) !new window attributes - test1
   iret = SetWindowLong(hWnd, GWL_STYLE, iflg)
end subroutine test_SetWindowLong_quickwin

In both cases (comment test1 or test2) the call to setwindowlong kills the child window but without repainting the area occupied by it. Would you suggest some different options? In the case of the test2 under debug there are also some exceptions regarding unprocessed messages.

That's the trouble with Quickwin (comment from a non-user): without access to the proc function you have no way of implementing operations which would otherwise be simple and straightforward.  So if the child becomes kill-able via its cancel button but the parent window does not automatically repaint when the child vanishes (since, after all, how would it know?), your code could send a WM_REPAINT message to the app's parent (or, more elegantly, invalidate the rect previously occupied by the child).

@Paul: Yup but the repaint isn't the problem it is that fact that the window gets killed by the attempt to modify it....

@Intel: The question of the [x] box in qwin child windows has been raised by several users over a number of years with no answer, some insight would be helpful. 

A number of years ago Jugoslav provided the answer: as I remember it, it is a quirk of Windows that the x button is disabled unless the child window contains an IDCANCEL button plus a callback.  I have on a number of occasions inserted into child windows an invisible IDCANCEL button (+ callback) in order to activate the x button.

Bear of little brain

Leave a Comment

Please sign in to add a comment. Not a member? Join today