Link to home
Start Free TrialLog in
Avatar of Todd MacPherson
Todd MacPhersonFlag for Canada

asked on

HELP WANTED: Question on autoscroll with Input Panel and Tab Control VB.Net Compact Framework

My code is set to fire when a user clicks inside a textbox and triggers the following event in GotFocus

        If Not InputPanel1 Is Nothing Then
            If InputPanel1.Enabled = False Then
                InputPanel1.Enabled = True
            End If
        End If


That fires the following code:


Private Sub InputPanel1_EnabledChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles InputPanel1.EnabledChanged
        If InputPanel1.Enabled = False Then
            For Each Me.tbPge In tabNOG.TabPages
                tbPge.AutoScroll = False
            Next

            tabNOG.Height = 267
            tabNOG.Width = 240
        Else
            ' The SIP is enabled, so the height of the tab control
            ' is set to the height of the visible desktop area.
            For Each Me.tbPge In tabNOG.TabPages
                tbPge.AutoScroll = True
                tbPge.AutoScrollMargin = New Size(5, 5)
                Dim ctrl As Control
                For Each ctrl In tbPge.Controls
                    If TypeOf ctrl Is TextBox Then
                        If ctrl.Focused = True Then
                            Dim intpos As Integer
                            intpos = ctrl.Location.Y
                            tbPge.AutoScrollPosition = New Point(0, intpos - tbPge.AutoScrollPosition.Y)
                        End If
                    End If
                Next
            Next

            tabNOG.Height = InputPanel1.VisibleDesktop.Height
            tabNOG.Width = InputPanel1.VisibleDesktop.Width
        End If
    End Sub

The problem I am having is if the textbox is below / under the InputPanel it does not autoscroll to that textbox making it visible to the user so they can see the textbox while inputting. Why?
ASKER CERTIFIED SOLUTION
Avatar of Todd MacPherson
Todd MacPherson
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Todd MacPherson

ASKER

not elegant but it works. I will leave open in case an expert has something to offer.
Closing question