Page 1 of 1

Event for moving a window

Posted: Wed Mar 17, 2021 4:04 am
by hmgchang
Hola Masters,

i can use ON SIZE event when i size a window,
but how about moving a window... any ON MOVE ?

or how can i catch the move event ?
windowsEvents.JPG
windowsEvents.JPG (50.7 KiB) Viewed 1952 times
Thks n rgds
Chang

Re: Event for moving a window

Posted: Wed Mar 17, 2021 5:27 am
by andyglezl
Maybe...

OnMouseDrag Event
Occurs when the user drag in a Window


Syntax:

OnMouseDrag <ActionProcedure>
The following data are available at ‘OnMouseClick’ procedure:

_HMG_SYSDATA [ 191 ] -> Mouse Row

_HMG_SYSDATA [ 192 ] -> Mouse Col

Re: Event for moving a window

Posted: Wed Mar 17, 2021 6:18 am
by hmgchang
Hola and thanks Andy,

it happen if the mouse pointer is inside the window that wont cause the window
to move.

When we move window the mouse is at the title bar of the window,
that what can move the whole window across the screen,
unfortunately i don't know what event to check ( ON MOVE ?)

Thks n Rgds
Chang
HMG -
Happy Make Good

Re: Event for moving a window

Posted: Wed Mar 17, 2021 7:42 am
by AUGE_OHR
hi,

do you you wat to move hole Window :?:

Code: Select all

   MoveWindow( hWnd, col, row, width, height, .T. )
Source is in x:\hmg.3.4.4\SOURCE\c_windows.c

Re: Event for moving a window

Posted: Wed Mar 17, 2021 10:16 am
by hmgchang
Hi Auge_OHR,
thks for the info.
Pls be kind to give a ssw ( small simple working) example
with hmg since I never learn C.

Thks n Rgds
Chang

Re: Event for moving a window

Posted: Wed Mar 17, 2021 10:44 am
by Claudio Ricardo
Hi... Maybe:

Code: Select all

#include <hmg.ch>

Function Main

PRIVATE nRow, nCol

	Load Window Main
	Main. Center

		nRow := GetProperty ("Main" , "Row")
		nCol := GetProperty ("Main" , "Col")

	Main. Activate

Return
// -------------------------------------------------------------------------------------------------------- //

Function OnMove

	If nRow <> GetProperty ("Main" , "Row") .OR. nCol <> GetProperty ("Main" , "Col")
	
		MsgInfo ("La ventana se ha movido !" , "Aviso !")

		nRow := GetProperty ("Main" , "Row")
		nCol := GetProperty ("Main" , "Col")

	EndIf
	
Return Nil
In Main.fmg set:
OnMouseMove OnMove ()

Re: Event for moving a window

Posted: Wed Mar 17, 2021 2:29 pm
by edk