Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Best Double Click method....
#7
I did a routine with UDTs for a button demo with hardware acceleration. Taking the above and converting it to UDT's is similar. In this demo you can drag the suare...

Code: (Select All)
Type MyMouse
    x As Integer
    y As Integer
    lb As Integer
    rb As Integer
    mb As Integer
    mw As Integer
    clkcnt As Integer
    prevx As Integer
    prevy As Integer
    drag As Integer
End Type
Dim m As MyMouse

Locate 2, 39: Print Chr$(219);
Do
    mouse m
    Locate 1, 1: Print "Left Click Count:    "; m.clkcnt;: If m.clkcnt = 2 Then Sound 1000, .1
    Locate 2, 1: Print "Left Button Status:  "; m.lb
    Locate 3, 1: Print "Middle Button Status:"; m.mb
    Locate 4, 1: Print "Right Button Status: "; m.rb
    Locate 5, 1: Print "Mouse Wheel Status:  "; m.mw: If m.mw Then _Delay .1 ' Delay allows it to show.
    Locate 7, 1: Print "Row and Column: "; m.y; " "; m.x; "  ";
    If m.y Then
        If Screen(m.y, m.x, 0) = 219 Or m.drag Then
            If m.lb = -1 Then
                m.drag = -1
            Else
                If m.drag Then
                    If m.y <> m.prevy Or m.x <> m.prevx Then
                        Locate m.prevy, m.prevx: Print Chr$(32);
                        Locate m.y, m.x: Print Chr$(219);
                    End If
                End If
            End If
        End If
    End If
Loop

Sub mouse (m As MyMouse)
    Static z1
    m.prevx = m.x: m.prevy = m.y
    If m.mw Then m.mw = 0
    While _MouseInput
        m.mw = m.mw + _MouseWheel: If m.mw Then m.mw = m.mw \ Abs(m.mw) ' Limit to 1 or -1 for up or down.
    Wend
    m.x = _MouseX
    m.y = _MouseY
    If z1 Then If Abs(Timer - z1) > .25 Then z1 = 0: m.clkcnt = 0
    Select Case m.lb
        Case 2: m.lb = 0 ' Click cycle completed.
        Case 1: If _MouseButton(1) = 0 Then m.lb = 2: m.drag = 0 ' Button released.
        Case -1: m.lb = 1 ' Button held down.
        Case 0: m.lb = _MouseButton(1)
    End Select
    Select Case m.mb
        Case 2: m.mb = 0 ' Click cycle completed.
        Case 1: If _MouseButton(3) = 0 Then m.mb = 2 ' Button released.
        Case -1: m.mb = 1 ' Button held down.
        Case 0: m.mb = _MouseButton(3)
    End Select
    Select Case m.rb
        Case 2: m.rb = 0 ' Click cycle completed.
        Case 1: If _MouseButton(2) = 0 Then m.rb = 2 ' Button released.
        Case -1: m.rb = 1 ' Button held down.
        Case 0: m.rb = _MouseButton(2)
    End Select
    If m.lb = -1 Then z1 = Timer: m.clkcnt = m.clkcnt + 1
End Sub
Shoot first and shoot people who ask questions, later.
Reply


Messages In This Thread
Best Double Click method.... - by Unseen Machine - 10-30-2025, 12:36 AM
RE: Best Double Click method.... - by Pete - 10-30-2025, 03:20 AM
RE: Best Double Click method.... - by Pete - 10-30-2025, 03:53 AM
RE: Best Double Click method.... - by SMcNeill - 10-30-2025, 05:53 AM
RE: Best Double Click method.... - by Pete - 10-30-2025, 08:50 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Double slit experiment vince 7 1,715 07-18-2024, 11:06 PM
Last Post: Pete
  Click Away Balls bplus 6 1,595 05-16-2022, 01:04 PM
Last Post: Dav

Forum Jump:


Users browsing this thread: 1 Guest(s)