Results 1 to 9 of 9

Thread: scroll buttons

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Aug 2000
    Location
    Oslo, Norway
    Posts
    22

    Question

    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

  2. #2
    Fanatic Member
    Join Date
    Oct 1999
    Location
    England
    Posts
    982
    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")


    Things I do when I am bored: DotNetable

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Aug 2000
    Location
    Oslo, Norway
    Posts
    22
    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

  4. #4
    Guest
    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

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Aug 2000
    Location
    Oslo, Norway
    Posts
    22
    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

  6. #6
    Guest
    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

  7. #7

    Thread Starter
    Junior Member
    Join Date
    Aug 2000
    Location
    Oslo, Norway
    Posts
    22
    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

  8. #8
    Guest
    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

  9. #9
    Guest
    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
  •  



Click Here to Expand Forum to Full Width