ON MOUSEDRAG ?
Moderator: Rathinagiri
ON MOUSEDRAG ?
Hola a todos
Como puedo saber cuando se mueve de lugar una ventana ?
Probé con "ON MOUSEDRAG" pero no ejecuta mi funcion. Algun ejemplo ?
------------------------------------------------------------------------
Hello everyone
As I can know when moving from place a window?
I tried "ON MOUSEDRAG" but does not execute my function. Some example?
-------------------------------------------------------------------------
Como puedo saber cuando se mueve de lugar una ventana ?
Probé con "ON MOUSEDRAG" pero no ejecuta mi funcion. Algun ejemplo ?
------------------------------------------------------------------------
Hello everyone
As I can know when moving from place a window?
I tried "ON MOUSEDRAG" but does not execute my function. Some example?
-------------------------------------------------------------------------
Andrés González López
Desde Guadalajara, Jalisco. México.
Desde Guadalajara, Jalisco. México.
- Pablo César
- Posts: 4059
- Joined: Wed Sep 08, 2010 1:18 pm
- Location: Curitiba - Brasil
ON MOUSEDRAG ?
Hola Andrés,
Fijate si este ejemplo te ayuda a resolver. Try this: Message re-edited to attached mouse pointers files and for second time to include source code file (was missing, sorry).
Fijate si este ejemplo te ayuda a resolver. Try this: Message re-edited to attached mouse pointers files and for second time to include source code file (was missing, sorry).
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
- Pablo César
- Posts: 4059
- Joined: Wed Sep 08, 2010 1:18 pm
- Location: Curitiba - Brasil
ON MOUSEDRAG ?
Disculpame. La solucion que presenté, creo que no resuelve tu caso.
Sorry. This example which I had presented, will not solve your case.
Sorry. This example which I had presented, will not solve your case.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
- esgici
- Posts: 4543
- Joined: Wed Jul 30, 2008 9:17 pm
- DBs Used: DBF
- Location: iskenderun / Turkiye
- Contact:
Re: ON MOUSEDRAG ?
I'm not sure that I have understood correctandyglezl wrote: As I can know when moving from place a window?
I tried "ON MOUSEDRAG" but does not execute my function. Some example?
I hope attached sample will help you
Happy HMG'ing
Viva INTERNATIONAL HMG
- srvet_claudio
- Posts: 2193
- Joined: Thu Feb 25, 2010 8:43 pm
- Location: Uruguay
- Contact:
Re: ON MOUSEDRAG ?
See this code:andyglezl wrote:Hola a todos
Como puedo saber cuando se mueve de lugar una ventana ?
Probé con "ON MOUSEDRAG" pero no ejecuta mi funcion. Algun ejemplo ?
------------------------------------------------------------------------
Hello everyone
As I can know when moving from place a window?
I tried "ON MOUSEDRAG" but does not execute my function. Some example?
-------------------------------------------------------------------------
Code: Select all
#include "hmg.ch"
Function Main
DEFINE WINDOW Form_1 ;
AT 0,0 ;
WIDTH 640 ;
HEIGHT 480 ;
TITLE 'Move Window' ;
MAIN
@ 100 , 10 LABEL Label_X VALUE "" AUTOSIZE
@ 150 , 10 LABEL Label_Y VALUE "" AUTOSIZE
END WINDOW
CENTER WINDOW Form_1
#define WM_MOVE 3
CREATE EVENT PROCNAME MoveTest() HWND Form_1.HANDLE MSG WM_MOVE
ACTIVATE WINDOW Form_1
Return
FUNCTION MoveTest()
LOCAL xPos := LOWORD(EventlParam())
LOCAL yPos := HIWORD(EventlParam())
Form_1.Label_X.Value := "X = " + HB_NTOS(xPos)
Form_1.Label_Y.Value := "Y = " + HB_NTOS(yPos)
RETURN NIL
- esgici
- Posts: 4543
- Joined: Wed Jul 30, 2008 9:17 pm
- DBs Used: DBF
- Location: iskenderun / Turkiye
- Contact:
Re: ON MOUSEDRAG ?
Apparently, we need ON MOVE eventsrvet_claudio wrote: ...
See this code:
...
Viva HMG
Viva INTERNATIONAL HMG
- Pablo César
- Posts: 4059
- Joined: Wed Sep 08, 2010 1:18 pm
- Location: Curitiba - Brasil
ON MOUSEDRAG ?
Very Good Doctor !!srvet_claudio wrote:See this code:
..//..
#define WM_MOVE 3
CREATE EVENT PROCNAME MoveTest() HWND Form_1.HANDLE MSG WM_MOVE
..//..
FUNCTION MoveTest()
LOCAL xPos := LOWORD(EventlParam())
LOCAL yPos := HIWORD(EventlParam())
Form_1.Label_X.Value := "X = " + HB_NTOS(xPos)
Form_1.Label_Y.Value := "Y = " + HB_NTOS(yPos)
RETURN NIL
So the code I posted could be improved like this:
Code: Select all
#include "hmg.ch"
#define HTCAPTION 2
#define WM_MOVE 3
#define WM_NCLBUTTONDOWN 161
Function Main
DEFINE WINDOW Form_1 ;
AT 0,0 ;
WIDTH 400 ;
HEIGHT 200 ;
TITLE 'Hello World!' ;
MAIN ;
ON MOUSECLICK MoveActiveWindow()
ON KEY ESCAPE ACTION ThisWindow.Release
DEFINE STATUSBAR
STATUSITEM "Click on Form and holding mouse's button for moving this window"
END STATUSBAR
DEFINE LABEL Label_1
ROW 100
COL 10
VALUE ""
END LABEL
END WINDOW
// Form_1.Cursor := "hand32-32.cur"
Form_1.Cursor := "Move-32.cur"
CENTER WINDOW Form_1
CREATE EVENT PROCNAME MoveTest() HWND Form_1.HANDLE MSG WM_MOVE
ACTIVATE WINDOW Form_1
Return Nil
Function MoveActiveWindow( hWnd )
DEFAULT hWnd := GetActiveWindow()
PostMessage( hWnd, WM_NCLBUTTONDOWN, HTCAPTION, 0 )
// FileCursor( "Grabbed32-32.cur" )
FileCursor( "Maggy.ani" )
Return Nil
Function MoveTest()
Local xPos := LOWORD(EventlParam())
Local yPos := HIWORD(EventlParam())
Form_1.Label_1.Value:="Lin: "+Str(yPos,3,0)+" / Col: "+Str(xPos,3,0)
Return Nil
#pragma BEGINDUMP
#include <windows.h>
HB_FUNC( FILECURSOR )
{
hb_retnl( ( LONG ) SetCursor( LoadCursorFromFile( hb_parc( 1 ) ) ) );
}
#pragma ENDDUMP
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
- Pablo César
- Posts: 4059
- Joined: Wed Sep 08, 2010 1:18 pm
- Location: Curitiba - Brasil
ON MOUSEDRAG ?
Hereunder is some cursor pointers, one is animated cursor pointer.
I hope you enjoy ! (Sorry I couldn't resist it...)HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
Re: ON MOUSEDRAG ?
Gracias Pablo César, esgici y Claudio
Revisé los ejemplos que enviaron e hice esto.
La idea que traigo es crear 2 ventanas, y que al mover la ventana 'Main',
la ventana 'Child' se acople a un lado de la 'Main'.
El siguiente código ya lo hace, hay que mover la ventana MAIN y darle click,
la ventana CHILD se ubicara a un lado de la MAIN. Lo que quiero es que
automaticamente la ventana CHILD se "acople" al deja de pulsar el botón del
ratón.
-------------------------------------------------------------------------
Thanks Pablo Cesar, Esgici and Claudio
I checked the examples sent and made this.
The idea is to create 2 windows bring, and that moving the window 'Main'
window 'Child' engages a side of the 'Main'.
The following code already does, you have to move the MAIN window and give click,
CHILD window was located on one side of the MAIN. What I want is that
CHILD window is automatically "attach" to stop pressing the button
mouse.
-----------------------------------------------------------------------------
Revisé los ejemplos que enviaron e hice esto.
La idea que traigo es crear 2 ventanas, y que al mover la ventana 'Main',
la ventana 'Child' se acople a un lado de la 'Main'.
El siguiente código ya lo hace, hay que mover la ventana MAIN y darle click,
la ventana CHILD se ubicara a un lado de la MAIN. Lo que quiero es que
automaticamente la ventana CHILD se "acople" al deja de pulsar el botón del
ratón.
-------------------------------------------------------------------------
Thanks Pablo Cesar, Esgici and Claudio
I checked the examples sent and made this.
The idea is to create 2 windows bring, and that moving the window 'Main'
window 'Child' engages a side of the 'Main'.
The following code already does, you have to move the MAIN window and give click,
CHILD window was located on one side of the MAIN. What I want is that
CHILD window is automatically "attach" to stop pressing the button
mouse.
-----------------------------------------------------------------------------
Code: Select all
#include "hmg.ch"
#define HTCAPTION 2
#define WM_MOVE 3
#define WM_NCLBUTTONDOWN 161
Function Main
DEFINE WINDOW Form_1 AT 0,0 WIDTH 400 HEIGHT 600 TITLE 'Hello World!' MAIN ;
ON MOUSECLICK MoveActiveWindow() ;
ON INIT ( CreaChild( GetFormHandle('Form_1') ), MoveActiveWindow( hWnd ) )
ON KEY ESCAPE ACTION ThisWindow.Release
DEFINE STATUSBAR
STATUSITEM "Click on Form and holding mouse's button for moving this window"
END STATUSBAR
END WINDOW
CENTER WINDOW Form_1
ACTIVATE WINDOW Form_1
Return Nil
FUNCTION CreaChild()
Local xPos := Form_1.Row
Local yPos := Form_1.Col
Local nWidth := Form_1.Width
DEFINE WINDOW Form_2 AT xPos,yPos+nWidth WIDTH 300 HEIGHT 200 TITLE 'WinChild' CHILD
ON KEY ESCAPE ACTION ThisWindow.Release
DEFINE STATUSBAR
STATUSITEM "This window CHILD will be 'anchored' to the MAIN ..."
END STATUSBAR
END WINDOW
ACTIVATE WINDOW Form_2
RETURN Nil
Function MoveActiveWindow( hWnd )
Local xPos := Form_1.Row
Local yPos := Form_1.Col
Local nWidth := Form_1.Width
DEFAULT hWnd := GetActiveWindow()
PostMessage( hWnd, WM_NCLBUTTONDOWN, HTCAPTION, 0 )
Form_1.StatusBar.Item(1):="Lin: "+Str(yPos,3,0)+" / Col: "+Str(xPos,3,0)
Form_2.Row:=xPos
Form_2.Col:=yPos+nWidth
Return Nil
- Attachments
-
- WinAcople.png (388.85 KiB) Viewed 7416 times
Andrés González López
Desde Guadalajara, Jalisco. México.
Desde Guadalajara, Jalisco. México.