I have 2 rich textboxes within an auto-scrolling panel object. The
textboxes aren't wider than the panel, so it never scrolls horizontally. But
the combined height of both textboxes is taller than that of the panel, so
the panel scrolls up and down in order to accomodate both of them. The user
can drag the Vscrollbar just fine and move about normally.
This setup is probably easier to illustrate than describe verbally:
---------------- < panel.top
|...................... < textbox1.top
|
|..................... < textbox1.height
|..................... < textbox2.top
|
|
---------------- < panel.height
....................... < textbox2.height
The panel needs to scroll primarily to accomodate textbox2, which is quite
tall.
The problem I'm experiencing is that when the user is typing into textbox2,
and the autoscroll of the panel is maintaining focus on the "carat" of the
textbox, something highly undesireable is happening at this point:
...................... < textbox1.top (currently out of viewable area)
...................... < textbox1.height (currently out of viewable
area)
..-.-.-.-.-.-.-.-.-. < textbox2.top, panel.top (autoscroll refuses to go
beyond this?)
|
|
|
|
|
|
---------------- < panel.height
^ < typing carat (currently out of viewable
area - bad!)
....................... < textbox2.height (currently out of viewable
area)
Autoscroll seems convinced that it should "never scroll down so much that
the .top of the currently focused textbox is outside the viewable area, even
if that means sacrificing the visibility of the typing carat". In my
application it's perfectly acceptable if the .top of the currently focused
textbox scrolls up out of viewable area - what's important to me is keeping
the carat within the viewable area, so the user can see what they're typing.
In this scenario, the user must now grab the bar with the mouse and manually
scroll down to reveal their carat. I want to do this for them,
programmatically.
The .top of textbox2 is 97, relative to the panel. I cannot manage to
scroll the panel to any point beyond 97 while retaining focus of textbox2 (I
can remove focus from textbox2 and scroll beyond 97, however, as soon as
textbox2 regains focus, autoscroll immediately jumps to 97 irrespective of
manually setting the autoscrollposition of the panel).
Manually setting the autoscrollposition of the panel seems unable to defeat
this issue. While the panel will report back that the new
autoscrollposition.Y is indeed 120, 100, or whatever I put there, what we
see on the screen does not change - it remains 97, and the carat remains
hidden from view below the lower boundry of the panel. I have not managed
to programatically scroll to any point beyond 97 in this scenario. I hope
this makes sense, any suggestions would be greaty appreciated.