Page 1 of 1
Resizing a window
Posted: Sat Dec 08, 2007 12:34 am
by Rafael Clemente
When resizing a window, I can see continuously its vertical size with the following code:
Code: Select all
::OnResize := {|r,c,f| ::cTxt := Str(::nHeight)}
@ 20,20 Say ::cTxt ........
But, how can I detect the moment when I release the left button so that I can save the window size at that moment? I have tried
bLButtonUp := {|r,c| MsgInfo(Str(::nHeight))} but it does not seem to work when the cursor in over a window corner or border.
Thanks
Rafael
Posted: Sat Dec 08, 2007 10:17 am
by Antonio Linares
Rafael,
> it does not seem to work when the cursor in over a window corner or border
bLButtonUp should work. If not then you may need to use a tool like MS Spy to find what message is sent to the window in such event
Posted: Sat Dec 08, 2007 11:03 am
by Rafael Clemente
Antonio:
Still it doesn't seem to work. Try this: Click within the window and the message pops up; resize the window and when you release the left button, no message appears:
Code: Select all
#include "Fivewin.ch"
FUNCTION Main()
LOCAL oWnd
DEFINE Window oWnd From 0,0 TO 300,400 Pixel Style WS_THICKFRAME
oWnd:bLButtonUp := {|r,c,f| MsgInfo(str(r)+str(c))}
ACTIVATE Window oWnd
Return Nil
What I would like is to be able to read the window height the moment I release the button. Any suggestion?
Rafael
Posted: Sat Dec 08, 2007 11:26 am
by Enrico Maria Giordano
Try using bResize instead.
EMG
Posted: Sat Dec 08, 2007 11:27 am
by Antonio Linares
Rafael,
You may need to use MS Spy and see if we get a message for such event
Posted: Sat Dec 08, 2007 12:06 pm
by Rafael Clemente
Antonio:
What is MS Spy and how do I get it? (In google I have found some references to anti spywares, My Space and so on, but I doubt they are related to this problem)
Enrico:
Yes; in my app I am using bResized updating continuously the window height. Like this:
Code: Select all
::bResize := {|t,w,h| ::nHeight := h}
However, I would like to be able to store the final nHeight in a Dbf. For that, I need to detect the ButtonUp event. And there is where I am having problems
Thanks to you both for your suggestions
Rafael
Posted: Sat Dec 08, 2007 2:08 pm
by Enrico Maria Giordano
Can't you simply save the window height at any bResize event?
EMG
Posted: Sat Dec 08, 2007 2:31 pm
by Rafael Clemente
Enrico:
Yes: That's what I am doing now. I just wondered if there was a way to do it only once, when the resizing is finished.
Rafael
Posted: Sat Dec 08, 2007 2:41 pm
by Antonio Linares
Rafael,
This seems to be the msg that you are looking for:
Posted: Sat Dec 08, 2007 6:38 pm
by Rafael Clemente
Antonio:
Thanks for your help but I am afraid this modification is way over my capabilities. What am I suposed to do with that event?. I have modified the HandleEvent() method in Windows.prg to capture WM_EXITSIZEDMOVE but it does nothing. I suppose I have to modify the method (or perhaps WndHandleEvent()) somewhere else but could not find where. Could you give me still another hint?
Thanks
Rafael
Posted: Sat Dec 08, 2007 9:05 pm
by Antonio Linares
Rafael,
Here you have a working sample:
Code: Select all
#include "FiveWin.ch"
#define WM_EXITSIZEMOVE 0x0232
function Main()
local oWnd := TMyWindow():New()
oWnd:Activate()
return nil
CLASS TMyWindow FROM TWindow
CLASSDATA lRegistered AS LOGICAL
METHOD HandleEvent( nMsg, nWParam, nLParam )
ENDCLASS
METHOD HandleEvent( nMsg, nWParam, nLParam ) CLASS TMyWindow
if nMsg == WM_EXITSIZEMOVE
MsgBeep()
endif
return Super:HandleEvent( nMsg, nWParam, nLParam )