Resizing a window

Post Reply
User avatar
Rafael Clemente
Posts: 365
Joined: Sat Oct 08, 2005 7:59 pm
Location: Barcelona, Spain

Resizing a window

Post 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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post 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
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Rafael Clemente
Posts: 365
Joined: Sat Oct 08, 2005 7:59 pm
Location: Barcelona, Spain

Post 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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Rafael,

You may need to use MS Spy and see if we get a message for such event
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Rafael Clemente
Posts: 365
Joined: Sat Oct 08, 2005 7:59 pm
Location: Barcelona, Spain

Post 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
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post by Enrico Maria Giordano »

Can't you simply save the window height at any bResize event?

EMG
User avatar
Rafael Clemente
Posts: 365
Joined: Sat Oct 08, 2005 7:59 pm
Location: Barcelona, Spain

Post 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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Rafael,

This seems to be the msg that you are looking for:

Image
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Rafael Clemente
Posts: 365
Joined: Sat Oct 08, 2005 7:59 pm
Location: Barcelona, Spain

Post 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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post 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 )
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply