The reason why I am sharing this is because my earlier approach is to use MouseDown() first to perform validation whether left mouse button is clicked, then call another user defined method like MoveMe(). What I wanted to show here is a more direct usage of an object's MouseMove() event. You drag (move) things via the left mouse button, so use MouseMove.
Here are the codes:
oForm=Newobject("Form1")
oForm.Show
Read Events
Return
Define Class Form1 As Form
Height
=
200
Width = 500
AutoCenter = .T.
ShowTips = .T.
TitleBar = 0
Add Object label1 As Label With ;
Caption = 'This is a
demo of moving Bordeless form by directly tapping onto MouseMove Event.',;
Top = 10, Left = 10, Width = 480, Height = 40, WordWrap = .T.
Add Object command1 As CommandButton
With ;
top = 160, Left = 400, Caption = '\<Close', Height = 30
Procedure Load
* This is for
dragging
Declare Integer SendMessage In win32API ;
integer HWnd, Integer wMsg, ;
integer wParam, Integer Lparam
Endproc
Procedure
MouseMove
Lparameters
nButton,
nShift, nXCoord, nYCoord
* Check first if
form is set to move or not
If m.nButton = 1
And Thisform.Movable = .T.
SendMessage(Thisform.HWnd, 0x202, 0x0,
0x0) && MouseUp
SendMessage(Thisform.HWnd, 0x112, 0xf012,
0x0) && Move form
Endif
Endproc
Procedure
command1.Click
Thisform.Release
Endproc
Procedure
Destroy
Clear
Events
Endproc
Enddefine
Cheers!