Re: How to scroll to text box when keyboard is displayed

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Well, basically, you want to adjust the autoscroll position so that the
control is in the right place. There are an infinite number of special
cases (where is the input panel? on a wide screen device, the input panel
might be right in the middle of the screen; how do I make a given control
visible in that situation, etc.), but something basically like this will
probably show up:

int pos = focusedControl.Location.Y;

currentTabPage.AutoScrollPosition =

new Point( 0, pos - currentTabPage.AutoScrollPosition.Y );



Paul T.

"The Mad Ape" <chiefape@xxxxxxxxx> wrote in message
news:h76cmf$1a2$1@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Paul G. Tobey [eMVP] wrote:
Wait, you want to tab to the next text box or move the text in a given
text box? Windows on Windows CE work basically just like they do on the
desktop (Tab to the next one, use the Down arrow to scroll).

When the input panel is enabled and there is a textbox that has focus
hidden behind the input panel, I have to manually scroll to that textbox
to enter data.

In my quest to make user input as efficient as possible, I want code that
detects when a textbox is obscured by the input panel. When detected I
want the textbox to show its ugly head automatically, without manually
scrolling to it.

Just saves a step but when a user does it a hundred times per day or more
it is time that adds up.

Thanks

TMA




Paul T.

"The Mad Ape" <chiefape@xxxxxxxxx> wrote in message
news:a1dc0c28-6280-4852-aad8-8f1649d69aae@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On Aug 27, 12:28 pm, The Mad Ape <chief...@xxxxxxxxx> wrote:
I have code in the GotFocus event that will display the virtual
keyboard when the focused object is a textbox. Not a problem, works
like a charm.

However if the next box is obscured by the keyboard I can not get the
autoscroll to work.

Here is the code to scroll to the textbox:

Private Sub txt1_LostFocus (ByVal sender As Objectm ByVal e As
System.EventArgs) Handles txt1.LostFocus

'This section just closes the Keyboard upon losing focus to this text
box. It works fine
If not InputPanel1 is Nothing Then
If InputPanel1.Enabled = True Then
InputPanel1.Enabled = False
End If
End If

'This does not work
If txt2.Visible = True Then
txt2.Focus()
txt2.ScrollToCaret()
End If

Also For your info I have this code in the GotFocus for txt2
If not InputPanel1 is Nothing Then
If InputPanel1.Enabled = False Then
InputPanel1.Enabled = True
End If
End If

Any ideas? There are other objects above these textboxes so by the
time the use gets to them, they have to enter data, scroll down to the
next one and enter data. It does set the focus on txt2 but it does not
scroll to it.

How can I fix this?

Thanks

TMA

I should also point out that the textboxes exist in a tab in Form 2.
I have used the EnabledChanged feature of the InputPanel to adjust
form size and scrolling.



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

tabCruise.Height = 267
tabCruise.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 tbPge In tabCruise.TabPages
tbPge.AutoScroll = True
tbPge.AutoScrollMargin = New Size(5, 5)
Next

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


.



Relevant Pages

  • Re: How to scroll to text box when keyboard is displayed
    ... Windows on Windows CE work basically just like they do on the desktop (Tab to the next one, use the Down arrow to scroll). ... When the input panel is enabled and there is a textbox that has focus hidden behind the input panel, I have to manually scroll to that textbox to enter data. ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: I need a text box that will both scroll and lock.
    ... I need a control that will let me display about 20 lines of text ... The Locked property works but the scroll bar does not appear unless ... Microsoft Forms 2.0 TextBox ... Any ideas for how to get one of these to both lock and show the scroll ...
    (microsoft.public.access.forms)
  • Re: need a control for good scrolling status output
    ... A regular textbox control would work perfectly fine for me if only as I ... visible and older info can scroll off the top of the textbox. ...
    (microsoft.public.dotnet.framework.windowsforms.controls)
  • Re: Access there isnt enough memory when scrolling textbox
    ... There is a 64KB limit when the user interaction with the control is ... I need to view a large amount of data in a a textbox (variable up to ... but I receive a 'there isnt enough memory' error whenever I ... it occurs at about the halfway scroll, ...
    (comp.databases.ms-access)
  • Re: Searching a textbox
    ... page of data when I hit the vertical scroll on the textbox), ... How can I automatically scroll to the 2nd page of the multiline text box? ... Seperate textboxes, RichTextBox or other control? ...
    (microsoft.public.dotnet.languages.vb)