Results 1 to 12 of 12

Thread: Mouse gestures ??? help please thanks

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2003
    Location
    In Front of my computer...
    Posts
    367

    Unhappy Mouse gestures ??? help please thanks

    Hi, what i want to do is have mouse gestures on a browser am making using webbrowser control... ok mouse gestures are like this for those who dont know

    press right button of the mouse and move the mouse to left it makes the browser goes back (Wb.GoBack)

    press right button of the mouse and move the mouse to right
    (WB.GoForward)

    anyway how can i acomplish this ???

    Help is apreciated and needed too lol... thanks


    Thank you very much to whoevers help...
    Last edited by EJ12N; Dec 10th, 2003 at 07:00 PM.
    Born to help others
    (If I've been helpful then please rate my post. Thanks)

    call me EJ or be slapped!

  2. #2

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2003
    Location
    In Front of my computer...
    Posts
    367
    bump^^^
    Born to help others
    (If I've been helpful then please rate my post. Thanks)

    call me EJ or be slapped!

  3. #3
    Lively Member
    Join Date
    Feb 2003
    Posts
    117
    Not quite sure of the specifics, but I'd say that whenever the right-mouse buttin is clicked, you check if the mouse moves in either direction, maybe a timer or something?

    </useless>

  4. #4
    Fanatic Member
    Join Date
    Sep 2000
    Posts
    770
    There is an API that can get x,y positions of the mouse pointer. With a loop, you can sample the data every 200 ms, or however much data you want to sample. Then from the data, you should be able to calculate the jestures. You will also have to define the jesture coordinates, and also give some space for human-error, as we all dont make the same circle or line. I have never written something like this before but as you can see, I though up a pretty good analysis right of the top of my head. There's to much code to write to do this so I am not even going to attempt. So have fun.
    Last edited by nkad; Dec 10th, 2003 at 10:05 PM.

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2003
    Location
    In Front of my computer...
    Posts
    367
    well i guess i have to say bye bye mouse gestures from my project i knew would be hard oh well...thank you for your answers
    Born to help others
    (If I've been helpful then please rate my post. Thanks)

    call me EJ or be slapped!

  6. #6
    Only Slightly Obsessive jemidiah's Avatar
    Join Date
    Apr 2002
    Posts
    2,431
    It does sound like a very good feature. While circles would be much harder, this'll work for left and right:

    VB Code:
    1. Dim bMouseDown As Boolean
    2. Dim iMouseX As Single
    3. Dim iMouseY As Single
    4. Const Epsilon As Single = 500
    5.  
    6.  
    7. Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    8. If Button = vbRightButton Then bMouseDown = True
    9. iMouseX = X
    10. iMouseY = Y
    11. End Sub
    12.  
    13. Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    14. If bMouseDown = False Then Exit Sub
    15. If X - iMouseX >= Epsilon Then
    16.     Me.Caption = "Right"
    17. End If
    18. If X - iMouseX <= -Epsilon Then
    19.     Me.Caption = "Left"
    20. End If
    21. If Not (X - iMouseX <= -Epsilon) And Not (X - iMouseX >= Epsilon) Then
    22.     Me.Caption = ""
    23. End If
    24. End Sub
    25.  
    26. Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    27. bMouseDown = False
    28. Me.Caption = ""
    29. End Sub

    That gives a rough outline of how it can be used. Epsilon is the number of twips they have to move before whatever gesture is enacted. Hope it helps
    The time you enjoy wasting is not wasted time.
    Bertrand Russell

    <- Remember to rate posts you find helpful.

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2003
    Location
    In Front of my computer...
    Posts
    367
    Thanks but can this be used on a webbrowser control ???

    i dont need complicated gestures just left and right
    Born to help others
    (If I've been helpful then please rate my post. Thanks)

    call me EJ or be slapped!

  8. #8
    Fanatic Member
    Join Date
    Sep 2000
    Posts
    770
    Thanks but can this be used on a webbrowser control
    What do you think?

  9. #9

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2003
    Location
    In Front of my computer...
    Posts
    367
    Yes it did nkad but just a little thing that i would like to do

    to use the mouse gestures you gotta do it clickin on the form,
    there's anyway so if the user do it inside the webbrowser controls it works too ???

    also another question
    i got this history i.e

    google >>> yahoo >>> altavista

    ok when i do the mouse gestures with me on google it goes i put it so it goes forward but it goes SUPER forward lol it goes from google to altavista directly bypassing yahoo, and if im in altavista and i do the gesture go back (right mouse button and move mouse to left) it goes directly from altavista to google and that's not how is supposed to be

    anyway to fix that and having it go in a normal way like you in google goes to yahoo if u do gesture for forward then if you in yahoo goes to altavista but too bad is not like that right now so i'll wait for your answer or anyone else that wants to help


    Thanks...
    Born to help others
    (If I've been helpful then please rate my post. Thanks)

    call me EJ or be slapped!

  10. #10
    Fanatic Member
    Join Date
    Sep 2000
    Posts
    770
    Well, if you are recording your mouse x, y data with the API then it soudn't matter if the form has focus or not.

  11. #11

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2003
    Location
    In Front of my computer...
    Posts
    367
    what API

    im just using your code and when i do the mouse gestures inside the webbrowser control what i get is the right click menu lol...

    Pardon my ignorance im new to VB and dont know that much yet at least about APIs

    Thanks
    Born to help others
    (If I've been helpful then please rate my post. Thanks)

    call me EJ or be slapped!

  12. #12
    Only Slightly Obsessive jemidiah's Avatar
    Join Date
    Apr 2002
    Posts
    2,431
    Hmm, I hadn't thought about the right click menu coming up on the webbrowser control. You'd probably have to disable that if a gesture has taken place (it happens on MouseUp so it could be disabled on MouseDown). You could try searching for that if you do decide to do it (I'd assume you'd have to subclass for the MouseDown so you would probably just stifle the MouseUp message). As for it going extraordinarily fast, that's because it continues firing every time the mouse moves when it's past the boundary. You'd have to pause it for a time to stop that from happening or disable it until the mouse goes back over the boundary. Now (as if that wasn't enough), a popup menu seems to pause mouse events while it's visible, so you would have to use the timer suggested above.

    You could avoid all of that except for it going extremely fast if you used clicking of the mouse wheel.

    Overall, I guess it really is more work that it's probably worth, although it would get you extra credit for a school project
    The time you enjoy wasting is not wasted time.
    Bertrand Russell

    <- Remember to rate posts you find helpful.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width