Scrollbar on multiline textbox

G

Guest

Hey guys,

I have two questions regarding the vertical srollbar of a multiline textbox.

1. I have an "Ok" button that is initially disabled. I want it to be enabled
when the user scrolls the vertical scrollbar of a textbox all the way down
(indicating that the user at least pretended to read all of the textbox's
text). How can I monitor the scrollbar and know when it has reached the end?

2. My multiline textbox has VerticalScrollBar set to true. Now, the textbox
is not small and I might get text that will fit entirely without the need for
scrolling. In this case I want the same "Ok" button to be enabled
immediately. How can I tell if the text of a textbox will or will not
require vertical scrolling?

Thanks a lot,
-Flack
 
C

Chris Jobson

Flack said:
Hey guys,

I have two questions regarding the vertical srollbar of a multiline
textbox.

1. I have an "Ok" button that is initially disabled. I want it to be
enabled
when the user scrolls the vertical scrollbar of a textbox all the way down
(indicating that the user at least pretended to read all of the textbox's
text). How can I monitor the scrollbar and know when it has reached the
end?

2. My multiline textbox has VerticalScrollBar set to true. Now, the
textbox
is not small and I might get text that will fit entirely without the need
for
scrolling. In this case I want the same "Ok" button to be enabled
immediately. How can I tell if the text of a textbox will or will not
require vertical scrolling?

I don't know a nice way to do either of these, but you might br able to use
a timer to periodically compare the Y coordinate of the last character in
the text [which you can obtain using
myTextBox.GetPositionFromCharIndex(myTextBox.TextLength-1)] with the height
of the textbox. You'll have to make some adjustment for the height of the
line (as the character position is the top left of the character) and
possibly for inter-line spacing too - unless you can make the last line
something unimportant, such as "The End"!

Chris Jobson
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top