Detect when I have to refill the richtextbox vb6

June 05th, 2012 - 07:39 am ET by Catharinus van der werf | Report spam
Hello my friends

I have a vb6--form that contains a richtextbox and a command-button
with the capion 'Next Page'. On this form, I want to show the content
a a vb-string. The string can vary in length, it could contain 30
lines of text, but also 120 or 240 etc.
At a certain point I need a new page, that is emptying the richtextbox
and fill it with the next part of lines from the string. That should
be done by pressing the command-button
How can I easily and accurate detect the neccesity for a new page,
that contains the next part of the string that I want to show this
way.

Thanks in advantage,

Catharinus
email Follow the discussionReplies 21 repliesReplies Make a reply

Replies

#1 Mayayana
June 05th, 2012 - 09:11 am ET | Report spam
"Catharinus van der werf" wrote in message
news:
| Hello my friends
|
| I have a vb6--form that contains a richtextbox and a command-button
| with the capion 'Next Page'. On this form, I want to show the content
| a a vb-string. The string can vary in length, it could contain 30
| lines of text, but also 120 or 240 etc.
| At a certain point I need a new page, that is emptying the richtextbox
| and fill it with the next part of lines from the string. That should
| be done by pressing the command-button
| How can I easily and accurate detect the neccesity for a new page,
| that contains the next part of the string that I want to show this
| way.
|
Isn't that what the button is for? I read your question
several times, but I still don't get it. If you mean that
you need to find out how far down it's scrolled, you can
use something like the following to get the bottom line
number and then check the total number of lines by
using EM_EXLINEFROMCHAR and sending len(RTB.text)
for the last parameter.

Function GetBottomLine(hRTB as long) As Long '-- hRTB is RTB hWnd
'--get bottom line number by getting bottom point, then
'-- getting charfrompos for that point. returns nearest
'-- line number in high word.(?? supposed to but apparently doesn't.
'-- seems to only return character offset.)
Dim Pt1 As Point
Dim R1 As RECT
Dim LRet As Long, CPos As Long
On Error Resume Next
LRet = SendMessageAny(hRTB, EM_GETRECT, 0&, R1)
Pt1.X = 1
Pt1.Y = (R1.Bottom - R1.Top) - 1
LRet = SendMessageAny(hRTB, EM_CHARFROMPOS, 0&, Pt1)
GetBottomLine = SendMessageLong(hRTB, EM_EXLINEFROMCHAR, 0&, LRet)
End Function

Similar topics