|
-
Dec 10th, 2003, 04:51 PM
#1
Thread Starter
Hyperactive Member
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! 
-
Dec 10th, 2003, 07:01 PM
#2
Thread Starter
Hyperactive Member
bump^^^
Born to help others
(If I've been helpful then please rate my post. Thanks)
call me EJ or be slapped! 
-
Dec 10th, 2003, 09:38 PM
#3
Lively Member
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>
-
Dec 10th, 2003, 09:44 PM
#4
Fanatic Member
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.
-
Dec 10th, 2003, 10:28 PM
#5
Thread Starter
Hyperactive Member
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! 
-
Dec 10th, 2003, 11:33 PM
#6
It does sound like a very good feature. While circles would be much harder, this'll work for left and right:
VB Code:
Dim bMouseDown As Boolean
Dim iMouseX As Single
Dim iMouseY As Single
Const Epsilon As Single = 500
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbRightButton Then bMouseDown = True
iMouseX = X
iMouseY = Y
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If bMouseDown = False Then Exit Sub
If X - iMouseX >= Epsilon Then
Me.Caption = "Right"
End If
If X - iMouseX <= -Epsilon Then
Me.Caption = "Left"
End If
If Not (X - iMouseX <= -Epsilon) And Not (X - iMouseX >= Epsilon) Then
Me.Caption = ""
End If
End Sub
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
bMouseDown = False
Me.Caption = ""
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.
-
Dec 11th, 2003, 03:52 AM
#7
Thread Starter
Hyperactive Member
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! 
-
Dec 11th, 2003, 10:52 AM
#8
Fanatic Member
Thanks but can this be used on a webbrowser control
What do you think?
-
Dec 11th, 2003, 02:49 PM
#9
Thread Starter
Hyperactive Member
-
Dec 11th, 2003, 02:54 PM
#10
Fanatic Member
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.
-
Dec 11th, 2003, 04:09 PM
#11
Thread Starter
Hyperactive Member
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! 
-
Dec 12th, 2003, 12:16 AM
#12
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|