BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Scrolling richedit using WM_VSCROLL

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Usage)
View previous topic :: View next topic  
Author Message
Rory Walsh
Guest





PostPosted: Tue Apr 11, 2006 1:03 pm    Post subject: Scrolling richedit using WM_VSCROLL Reply with quote



I know this topic has been covered a million time but I have a problem
that I haven't been able to find a solution to so I hope you might be
able to help me. I am using the following code to cause my RichEdit to
scroll downwards as text is added to it:

RichEdit1->Perform(WM_VSCROLL, SB_BOTTOM, 0);

The problem is that on some machines it causes a crash reporting an
error in RichEdit20.dll? If I take out this one line everything works
fine. Does anyone know of an other albeit less efficient way to do the
same thing? There is not much text being added so I can't imagine that
it will slow down things too much. Of course it works fine on my machine
but I recently tried it on two machines, one with WIndows XP Home and
another with a version of XP Pro and it crashed on both. I think it may
have more to do with software installed rather than the OS. Any help is
much appreciated. Cheers,
Rory.
Back to top
George
Guest





PostPosted: Tue Apr 11, 2006 5:03 pm    Post subject: Re: Scrolling richedit using WM_VSCROLL Reply with quote



How are you adding the text? For me

RepRE->Lines->Append(line);

usually adds the line of text and scrolls down Ok
always showing the new, bottom line. This is with Widows XP
Professional.
But I have a new case when it does not scroll down, but still
shows the top of the RE. Maybe I need to set focus. Maybe I will test your code.

George

Rory Walsh <rorywalsh (AT) ear (DOT) ie> wrote:
Quote:
I am using the following code to cause my RichEdit to
scroll downwards as text is added to it:

RichEdit1->Perform(WM_VSCROLL, SB_BOTTOM, 0);

The problem is that on some machines it causes a crash reporting an
error in RichEdit20.dll?
Back to top
Rory Walsh
Guest





PostPosted: Tue Apr 11, 2006 6:04 pm    Post subject: Re: Scrolling richedit using WM_VSCROLL Reply with quote



And your code works for me! Cheers,
Rory.

George wrote:
Quote:
Ok Rory, your code works on my system

and it fixes my problem.

Thanks, George.

"George" <zombacity (AT) aol (DOT) com> wrote:
How are you adding the text? For me

RepRE->Lines->Append(line);

usually adds the line of text and scrolls down Ok
always showing the new, bottom line. This is with Widows XP
Professional.
But I have a new case when it does not scroll down, but still
shows the top of the RE. Maybe I need to set focus. Maybe I will test your code.

George

Rory Walsh <rorywalsh (AT) ear (DOT) ie> wrote:
I am using the following code to cause my RichEdit to
scroll downwards as text is added to it:

RichEdit1->Perform(WM_VSCROLL, SB_BOTTOM, 0);

The problem is that on some machines it causes a crash reporting an
error in RichEdit20.dll?
Back to top
Rory Walsh
Guest





PostPosted: Tue Apr 11, 2006 6:04 pm    Post subject: Re: Scrolling richedit using WM_VSCROLL Reply with quote

You can also do this
Richedit1->SelStart = Richedit1->Text.Length();
if you have HideSelection set to false.

Rory.


George wrote:
Quote:
Ok Rory, your code works on my system

and it fixes my problem.

Thanks, George.

"George" <zombacity (AT) aol (DOT) com> wrote:
How are you adding the text? For me

RepRE->Lines->Append(line);

usually adds the line of text and scrolls down Ok
always showing the new, bottom line. This is with Widows XP
Professional.
But I have a new case when it does not scroll down, but still
shows the top of the RE. Maybe I need to set focus. Maybe I will test your code.

George

Rory Walsh <rorywalsh (AT) ear (DOT) ie> wrote:
I am using the following code to cause my RichEdit to
scroll downwards as text is added to it:

RichEdit1->Perform(WM_VSCROLL, SB_BOTTOM, 0);

The problem is that on some machines it causes a crash reporting an
error in RichEdit20.dll?
Back to top
George
Guest





PostPosted: Tue Apr 11, 2006 6:04 pm    Post subject: Re: Scrolling richedit using WM_VSCROLL Reply with quote

Ok Rory, your code works on my system

and it fixes my problem.

Thanks, George.

"George" <zombacity (AT) aol (DOT) com> wrote:
Quote:

How are you adding the text? For me

RepRE->Lines->Append(line);

usually adds the line of text and scrolls down Ok
always showing the new, bottom line. This is with Widows XP
Professional.
But I have a new case when it does not scroll down, but still
shows the top of the RE. Maybe I need to set focus. Maybe I will test your code.

George

Rory Walsh <rorywalsh (AT) ear (DOT) ie> wrote:
I am using the following code to cause my RichEdit to
scroll downwards as text is added to it:

RichEdit1->Perform(WM_VSCROLL, SB_BOTTOM, 0);

The problem is that on some machines it causes a crash reporting an
error in RichEdit20.dll?
Back to top
George
Guest





PostPosted: Tue Apr 11, 2006 7:03 pm    Post subject: Re: Scrolling richedit using WM_VSCROLL Reply with quote

Unimportant, but I wonder why the help text says
// SB_BOTTOM Scrolls to the lower right.
When in fact for me it goes to lower left.

George.

Rory Walsh <rorywalsh (AT) ear (DOT) ie> wrote:
Quote:
You can also do this
Richedit1->SelStart = Richedit1->Text.Length();
if you have HideSelection set to false.

Rory.
Back to top
Rory Walsh
Guest





PostPosted: Tue Apr 11, 2006 8:03 pm    Post subject: Re: Scrolling richedit using WM_VSCROLL Reply with quote

That's one for the experts!

George wrote:
Quote:
Unimportant, but I wonder why the help text says
// SB_BOTTOM Scrolls to the lower right.
When in fact for me it goes to lower left.

George.

Rory Walsh <rorywalsh (AT) ear (DOT) ie> wrote:
You can also do this
Richedit1->SelStart = Richedit1->Text.Length();
if you have HideSelection set to false.

Rory.

Back to top
JD
Guest





PostPosted: Wed Apr 12, 2006 12:03 am    Post subject: Re: Scrolling richedit using WM_VSCROLL Reply with quote

Rory Walsh <rorywalsh (AT) ear (DOT) ie> wrote:
Quote:

[...] RichEdit1->Perform(WM_VSCROLL, SB_BOTTOM, 0);

I would suggest that you use EM_SCROLLCARET instead.

Just position the cursor where you want it by setting
SelStart and then scroll to it:

Richedit1->SelLength = 0;
Richedit1->SelStart = Richedit1->Text.Length();
RichEdit1->Perform( EM_SCROLLCARET, 0, 0 );

That will scroll to the very end of the data and be ready for
more data that can be added by setting the SelText.

~ JD
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Usage) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.