|
-
Nov 23rd, 2000, 05:02 AM
#1
Thread Starter
Junior Member
I'm making a webbrowser and need to make buttons for the scroll functions. (up, down, left, right).
I can not figure out how to make them.
Can someone please help.
Lars
Lars Jarle Mæhlum
http://www.touch-it.no
-
Nov 23rd, 2000, 05:41 AM
#2
Fanatic Member
I am not sure why you need to put scroll buttons on yourself. If you navigate to a page like in the example below the scroll bars will appear automatically on the webbrowser control.
Code:
WebBrowser1.Navigate ("http://www.microsoft.com")
-
Nov 23rd, 2000, 05:45 AM
#3
Thread Starter
Junior Member
Oh.
It's because I'm making a touch screen application, and I need separat buttons for this.
Lars
Lars Jarle Mæhlum
http://www.touch-it.no
-
Nov 23rd, 2000, 10:18 AM
#4
You can use SendKeys.
Code:
Private Sub Command1_Click()
Webbrowser1.SetFocus
SendKeys "{UP}"
End Sub
Private Sub Command2_Click()
Webbrowser1.SetFocus
SendKeys "{DOWN}"
End Sub
Private Sub Command3_Click()
Webbrowser1.SetFocus
SendKeys "{LEFT}"
End Sub
Private Sub Command4_Click()
Webbrowser1.SetFocus
SendKeys "{RIGHT}"
End Sub
-
Nov 24th, 2000, 02:56 AM
#5
Thread Starter
Junior Member
Thank you Matthew!
Yes this looks good, and is similar to what I figured out, but I still have two problems.
1.
On som html-pages Mr. Setfocus doesn't his job. I often have to put the cursor in the web myself before I can scroll.
2.
I'd like to have the scroll on the mousedown so that it scrolls as long as I hold the button in, and stops on mouseup. I have tried a getTickcount method, but I'm not to familiar with it.
Anyone have any ideas?
Lars
Lars Jarle Mæhlum
http://www.touch-it.no
-
Nov 24th, 2000, 08:00 PM
#6
What you want to do is purdy simple .
Code:
Dim MouseUp As Boolean
Private Sub Command1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If MouseUp = False Then
Webbrowser1.SetFocus
Do
DoEvents
SendKeys "{UP}", True
Loop Until MouseUp = True
End If
If MouseUp = True Then MouseUp = False
End Sub
Private Sub Command1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
MouseUp = True
End Sub
Private Sub Command2_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If MouseUp = False Then
Webbrowser1.SetFocus
Do
DoEvents
SendKeys "{DOWN}", True
Loop Until MouseUp = True
End If
If MouseUp = True Then MouseUp = False
End Sub
Private Sub Command2_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
MouseUp = True
End Sub
Private Sub Command3_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If MouseUp = False Then
Webbrowser1.SetFocus
Do
DoEvents
SendKeys "{LEFT}", True
Loop Until MouseUp = True
End If
If MouseUp = True Then MouseUp = False
End Sub
Private Sub Command3_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
MouseUp = True
End Sub
Private Sub Command4_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If MouseUp = False Then
Webbrowser1.SetFocus
Do
DoEvents
SendKeys "{RIGHT}", True
Loop Until MouseUp = True
End If
If MouseUp = True Then MouseUp = False
End Sub
Private Sub Command4_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
MouseUp = True
End Sub
-
Nov 27th, 2000, 03:51 AM
#7
Thread Starter
Junior Member
Thanxs Matthew!
The code looks great, but we need to set MouseUp to false somewhere so that the browser scrolls, don't we?
Lars
Lars Jarle Mæhlum
http://www.touch-it.no
-
Nov 27th, 2000, 07:13 AM
#8
MouseUp is set to false.
Code:
'Private Sub Command_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
'If MouseUp = False Then
'Webbrowser1.SetFocus
'Do
'DoEvents
'SendKeys "{....}", True
'Loop Until MouseUp = True
'End If
If MouseUp = True Then MouseUp = False
'End Sub
-
Nov 27th, 2000, 07:48 AM
#9
All of the code I gave works. I tested it before I posted .
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
|