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.
-----------------------------------------------------------------------------
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