Resizing a window

Resizing a window

Postby Rafael Clemente » Sat Dec 08, 2007 12:34 am

When resizing a window, I can see continuously its vertical size with the following code:
Code: Select all  Expand view  RUN
::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
Rafael Clemente
 
Posts: 365
Joined: Sat Oct 08, 2005 7:59 pm
Location: Barcelona, Spain

Postby Antonio Linares » Sat Dec 08, 2007 10:17 am

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

Postby Rafael Clemente » Sat Dec 08, 2007 11:03 am

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  Expand view  RUN
#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
Rafael Clemente
 
Posts: 365
Joined: Sat Oct 08, 2005 7:59 pm
Location: Barcelona, Spain

Postby Enrico Maria Giordano » Sat Dec 08, 2007 11:26 am

Try using bResize instead.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8716
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Antonio Linares » Sat Dec 08, 2007 11:27 am

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

Postby Rafael Clemente » Sat Dec 08, 2007 12:06 pm

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  Expand view  RUN
::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
Rafael Clemente
 
Posts: 365
Joined: Sat Oct 08, 2005 7:59 pm
Location: Barcelona, Spain

Postby Enrico Maria Giordano » Sat Dec 08, 2007 2:08 pm

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

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8716
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Rafael Clemente » Sat Dec 08, 2007 2:31 pm

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
Rafael Clemente
 
Posts: 365
Joined: Sat Oct 08, 2005 7:59 pm
Location: Barcelona, Spain

Postby Antonio Linares » Sat Dec 08, 2007 2:41 pm

Rafael,

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

Image
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42107
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Rafael Clemente » Sat Dec 08, 2007 6:38 pm

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
Rafael Clemente
 
Posts: 365
Joined: Sat Oct 08, 2005 7:59 pm
Location: Barcelona, Spain

Postby Antonio Linares » Sat Dec 08, 2007 9:05 pm

Rafael,

Here you have a working sample:
Code: Select all  Expand view  RUN
#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
User avatar
Antonio Linares
Site Admin
 
Posts: 42107
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 58 guests