Very good!!!Pablo César wrote:Andrés, tomé tu ejemplo, más lo que yo ya habia postado y más la idea imprecindible del Claudio, surgió este efecto:Fijate si es o que querias.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( GetFormHandle('Form_1') ) ; ON INIT CreaChild() ; ON SIZE (MoveTest(),ChgChild()) ; NOMAXIMIZE NOMINIMIZE 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 CREATE EVENT PROCNAME MoveTest() HWND Form_1.HANDLE MSG WM_MOVE ACTIVATE WINDOW Form_1 Return Nil Function CreaChild() Local xPos := Form_1.Col Local yPos := Form_1.Row Local nWidth := Form_1.Width DEFINE WINDOW Form_2 AT yPos,xPos+nWidth WIDTH 300 HEIGHT 200 TITLE 'WinChild' CHILD NOSYSMENU 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 ) PostMessage( hWnd, WM_NCLBUTTONDOWN, HTCAPTION, 0 ) Return Nil Function MoveTest() Local xPos := LOWORD(EventlParam()) Local yPos := HIWORD(EventlParam()) Local nWidth := Form_1.Width Form_1.StatusBar.Item(1):="Lin: "+Str(yPos,4,0)+" / Col: "+Str(xPos,4,0)+" | "+Str(nWidth,4,0) ChgChild() Return Nil Function ChgChild() Local xPos := Form_1.Col Local yPos := Form_1.Row Local nWidth := Form_1.Width Form_2.Row:=yPos Form_2.Col:=xPos+nWidth Return Nil
I mixed up all examples, but the most important is to create the MOVE event that Claudio has indicated.
ON MOUSEDRAG ?
Moderator: Rathinagiri
- srvet_claudio
- Posts: 2193
- Joined: Thu Feb 25, 2010 8:43 pm
- Location: Uruguay
- Contact:
Re: ON MOUSEDRAG ?
- srvet_claudio
- Posts: 2193
- Joined: Thu Feb 25, 2010 8:43 pm
- Location: Uruguay
- Contact:
Re: ON MOUSEDRAG ?
Andy, probablemente utilices código de pagina en español, hace en HMG.3.1.5:andyglezl wrote: El detalle está en que yo todavia sigo con HMG 3.46 y algunas lineas me dan error.
Voy a ver si lo puedo solucionar. (espero pronto poder dar el paso a 3.1.5 )
Code: Select all
Function Main
SET CODEPAGE TO SPANISH
...
Return
PD: Todos las versiones de HMG.3.1.xx son mixtas, funcionan tanto en ANSI como en UNICODE, basta especificar el código de pagina apropiado (no es necesario volver a compilar la biblioteca de HMG en ANSI).
-
- Posts: 1275
- Joined: Tue Sep 03, 2013 4:22 am
- Location: Tecámac, México
Re: ON MOUSEDRAG ?
Hola a todos, he tretado de compilar los ejemplos y me da un error. HMG.3.0.46
/////////////////////////////////////////////////////////////////////////////////////////////
Hi all, I tretado to compile the examples and gives me an error. HMG.3.0.46
El ejemplo que compile:
En que estaré mal?, alguna sugerencia por favor. GRACIAS.
////////////////////////////////////////////////////////////////////////////////////////////
In that I'll be bad?, Any suggestions please. Thank you.
/////////////////////////////////////////////////////////////////////////////////////////////
Hi all, I tretado to compile the examples and gives me an error. HMG.3.0.46
Code: Select all
Harbour 3.2.0dev (Rev. 18443)
Copyright (c) 1999-2012, http://harbour-project.org/
C:\hmg\Mios\DetectaMovWin\Main2.PRG(23) Error E0030 Syntax error "syntax error at 'EVENT'"
1 error
Code: Select all
#include "hmg.ch"
#define HTCAPTION 2
#define WM_MOVE 3
#define WM_NCLBUTTONDOWN 161
Function Main
SET CODEPAGE TO SPANISH
DEFINE WINDOW Form_1 AT 0,0 WIDTH 400 HEIGHT 600 TITLE 'Hello World!' MAIN ;
ON MOUSECLICK MoveActiveWindow( GetFormHandle('Form_1') ) ;
ON INIT CreaChild() ;
ON SIZE (MoveTest(),ChgChild()) ;
NOMAXIMIZE NOMINIMIZE
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
CREATE EVENT PROCNAME MoveTest() HWND Form_1.HANDLE MSG WM_MOVE
ACTIVATE WINDOW Form_1
Return Nil
Function CreaChild()
Local xPos := Form_1.Col
Local yPos := Form_1.Row
Local nWidth := Form_1.Width
DEFINE WINDOW Form_2 AT yPos,xPos+nWidth WIDTH 300 HEIGHT 200 TITLE 'WinChild' CHILD NOSYSMENU
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 )
PostMessage( hWnd, WM_NCLBUTTONDOWN, HTCAPTION, 0 )
Return Nil
Function MoveTest()
Local xPos := LOWORD(EventlParam())
Local yPos := HIWORD(EventlParam())
Local nWidth := Form_1.Width
Form_1.StatusBar.Item(1):="Lin: "+Str(yPos,4,0)+" / Col: "+Str(xPos,4,0)+" | "+Str(nWidth,4,0)
ChgChild()
Return Nil
Function ChgChild()
Local xPos := Form_1.Col
Local yPos := Form_1.Row
Local nWidth := Form_1.Width
Form_2.Row:=yPos
Form_2.Col:=xPos+nWidth
Return Nil
////////////////////////////////////////////////////////////////////////////////////////////
In that I'll be bad?, Any suggestions please. Thank you.
- Pablo César
- Posts: 4059
- Joined: Wed Sep 08, 2010 1:18 pm
- Location: Curitiba - Brasil
ON MOUSEDRAG ?
Hola Javier,
Ese ejemplo que posté es para la version 3.1.5. Es ese tu error, porque estarias utilizando una version donde no reconoce nuevas funciones que fueron implementadas.
Y lo que decia el Dr. Soto, es que se puede utilizar la ultima version con codepage para español.
--
Hi Javier,
That example that I had posted is for version 3.1.5. Is that your mistake because you'd be using a version which does not recognize new features that were implemented.
And what he said Dr. Soto, is that you can use the latest version with codepage for Spanish.
Ese ejemplo que posté es para la version 3.1.5. Es ese tu error, porque estarias utilizando una version donde no reconoce nuevas funciones que fueron implementadas.
Y lo que decia el Dr. Soto, es que se puede utilizar la ultima version con codepage para español.
--
Hi Javier,
That example that I had posted is for version 3.1.5. Is that your mistake because you'd be using a version which does not recognize new features that were implemented.
And what he said Dr. Soto, is that you can use the latest version with codepage for Spanish.
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
-
- Posts: 1275
- Joined: Tue Sep 03, 2013 4:22 am
- Location: Tecámac, México
Re: ON MOUSEDRAG ?
Gracias Pablo César, voy a instalar la nueva versión.
Re: ON MOUSEDRAG ?
Lo hice, es tan simple !
----------------------
I did, it's so simple!
----------------------
----------------------
I did, it's so simple!
----------------------
Code: Select all
#include "hmg.ch"
Function Main
PRIVATE nXY:=0
DEFINE WINDOW Form_1 AT 0,0 WIDTH 400 HEIGHT 600 TITLE 'Hello World!' MAIN ;
ON MOUSECLICK MoveActiveWindow( ) ;
ON INIT ( CreaChild( ) )
ON KEY ESCAPE ACTION ThisWindow.Release
DEFINE TIMER Timer_1 INTERVAL 500 ACTION MoveActiveWindow( ) // cada 1/2 segundos <============
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.Col
Local yPos := Form_1.Row
Local nWidth := Form_1.Width
DEFINE WINDOW Form_2 AT yPos,xPos+nWidth WIDTH 300 HEIGHT 200 TITLE 'WinChild' CHILD NOSYSMENU NOCAPTION
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( )
Local xPos := Form_1.Col
Local yPos := Form_1.Row
Local nWidth := Form_1.Width
IF nXY <> xPos+yPos <============
Form_1.StatusBar.Item(1):="Lin: "+Str(yPos,3,0)+" / Col: "+Str(xPos,3,0)
Form_2.Row:=yPos
Form_2.Col:=xPos+nWidth
nXY:=xPos+yPos
ENDIF <============
Return Nil
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
Re: ON MOUSEDRAG ?
Ahhh no vale con Timer...
With Timer... I thought it already. But try to make in code C in 3.0.46
With Timer... I thought it already. But try to make in code C in 3.0.46
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 ?
Another "Move Window" implementation :esgici wrote: ...
I hope attached sample will help you
...
This recalled me Law of the instrument
Happy HMG'ing
Viva INTERNATIONAL HMG
- Pablo César
- Posts: 4059
- Joined: Wed Sep 08, 2010 1:18 pm
- Location: Curitiba - Brasil
Re: ON MOUSEDRAG ?
Thanks, Claudio but all of these we can get with your valious work and all these routines, could be usefull for HMG Events Monitor example or in the future with GUI DEBUG...srvet_claudio wrote:Very good!!!Pablo César wrote:Andrés, tomé tu ejemplo, más lo que yo ya habia postado y más la idea imprecindible del Claudio, surgió este efecto:Fijate si es o que querias.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( GetFormHandle('Form_1') ) ; ON INIT CreaChild() ; ON SIZE (MoveTest(),ChgChild()) ; NOMAXIMIZE NOMINIMIZE 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 CREATE EVENT PROCNAME MoveTest() HWND Form_1.HANDLE MSG WM_MOVE ACTIVATE WINDOW Form_1 Return Nil Function CreaChild() Local xPos := Form_1.Col Local yPos := Form_1.Row Local nWidth := Form_1.Width DEFINE WINDOW Form_2 AT yPos,xPos+nWidth WIDTH 300 HEIGHT 200 TITLE 'WinChild' CHILD NOSYSMENU 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 ) PostMessage( hWnd, WM_NCLBUTTONDOWN, HTCAPTION, 0 ) Return Nil Function MoveTest() Local xPos := LOWORD(EventlParam()) Local yPos := HIWORD(EventlParam()) Local nWidth := Form_1.Width Form_1.StatusBar.Item(1):="Lin: "+Str(yPos,4,0)+" / Col: "+Str(xPos,4,0)+" | "+Str(nWidth,4,0) ChgChild() Return Nil Function ChgChild() Local xPos := Form_1.Col Local yPos := Form_1.Row Local nWidth := Form_1.Width Form_2.Row:=yPos Form_2.Col:=xPos+nWidth Return Nil
I mixed up all examples, but the most important is to create the MOVE event that Claudio has indicated.
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