help "Plain Box" How to make movable ?

  1. 5 days ago

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

    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:

    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

    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.

  2. Dave S

    Nov 7 San Diego, California USA

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

  3. I'm a newbie .. any manual or tutorial or examples?

  4. Michel B

    Nov 8 Pre-Release Testers, Xojo Pro Answer RubberViews.com
    Edited 5 days ago

    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:

    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

    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.

  5. @Michel B 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:

    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

    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.

    thanks bro I could already move my application

or Sign Up to reply!