help "Plain Box" How to make movable ?

Real Basic 2009r2

Hello I would like to know what code or option I can move my “Plain Box” application
I want it to move

I have it in Plain Box for the skin … but I want it to move

without affecting the skin

someone knows how

some code

you need to capture and deal with mouse events within the window yourself.

I’m a newbie … any manual or tutorial or examples?

This is taken from /Applications/Xojo 2019 Release 2/Example Projects/Platform-Specific/Windows/CustomWindowShape:

You need to add to your window the following properties:

buttonDown as Boolean lastX as Integer lastY as Integer

Then implement the code in the following events:

[code]Function MouseDown(X As Integer, Y As Integer) Handles MouseDown as Boolean
lastX = X
lastY = Y
buttonDown = True
return True
End Function

Sub MouseDrag(X As Integer, Y As Integer) Handles MouseDrag
if buttonDown then
me.left = me.left + (X - lastX)
me.top = me.top + (Y - lastY)
end if
End Sub

Sub MouseUp(X As Integer, Y As Integer) Handles MouseUp
#PRAGMA unused X
#PRAGMA unused Y
buttonDown = False
End Sub
[/code]

Sub and End Sub are basically used internally by the program to define event handlers. In practice, you will see "MouseDown, MouseDrag, and MouseUp attached to the window in the left hand side of the IDE. Copy the code inside.

If you are lost, open the project in the examples next to the Xojo executable you get at in the Applications folder. Note that you cannot run the project on Mac, since it is made for Windows. But you can study the code.

[quote=462380:@Michel Bujardet]This is taken from /Applications/Xojo 2019 Release 2/Example Projects/Platform-Specific/Windows/CustomWindowShape:

You need to add to your window the following properties:

buttonDown as Boolean lastX as Integer lastY as Integer

Then implement the code in the following events:

[code]Function MouseDown(X As Integer, Y As Integer) Handles MouseDown as Boolean
lastX = X
lastY = Y
buttonDown = True
return True
End Function

Sub MouseDrag(X As Integer, Y As Integer) Handles MouseDrag
if buttonDown then
me.left = me.left + (X - lastX)
me.top = me.top + (Y - lastY)
end if
End Sub

Sub MouseUp(X As Integer, Y As Integer) Handles MouseUp
#PRAGMA unused X
#PRAGMA unused Y
buttonDown = False
End Sub
[/code]

Sub and End Sub are basically used internally by the program to define event handlers. In practice, you will see "MouseDown, MouseDrag, and MouseUp attached to the window in the left hand side of the IDE. Copy the code inside.

If you are lost, open the project in the examples next to the Xojo executable you get at in the Applications folder. Note that you cannot run the project on Mac, since it is made for Windows. But you can study the code.[/quote]

thanks bro I could already move my application