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 

Place the cursor at the begining of RichEdit1

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





PostPosted: Wed May 25, 2005 8:36 pm    Post subject: Place the cursor at the begining of RichEdit1 Reply with quote




My application fills in information in RichEdit and displays it as a log file.

However, I need to place the cursor at the begining of the file after the application is done adding info.
How can I do that?

Thanks in advance
Rob
Back to top
Daniel Mayo
Guest





PostPosted: Wed May 25, 2005 8:48 pm    Post subject: Re: Place the cursor at the begining of RichEdit1 Reply with quote



rob kemp wrote:

Quote:
My application fills in information in RichEdit and displays it as a log file.

However, I need to place the cursor at the begining of the file after the application is done adding info.
How can I do that?

Thanks in advance
Rob


RichEdit1->SelStart = 0;
RichEdit1->SelLength = 0;

Back to top
JD
Guest





PostPosted: Thu May 26, 2005 6:31 am    Post subject: Re: Place the cursor at the begining of RichEdit1 Reply with quote




Daniel Mayo <dmayo (AT) dickey-john (DOT) com> wrote:
Quote:

RichEdit1->SelStart = 0;
RichEdit1->SelLength = 0;

While that will place the cursor at the start, you also need
to scroll the text so that the cursor is in view:

RichEdit1->Perform( EM_SCROLLCARET, 0, 0 );

~ JD


Back to top
Daniel Mayo
Guest





PostPosted: Thu May 26, 2005 6:20 pm    Post subject: Re: Place the cursor at the begining of RichEdit1 Reply with quote

Forgot that placing the cursor at the start was a request..
EM_SCROLLCARET was something I have never used; ahh I learn something
new. (and overlooked that he was looking for a RichEdit1; my code would
works fine on a TMemo, and I assumed that they would be the same) and
noted also that to show the cursor with either TMemo or TRichEdit, you
have to send the SetFocus().

Kinda weird that TMemo and TRichEdit don't act the same in this case..

(You can see this feature in the following code snipit and some fooling
around.)

void __fastcall TForm1::Button1Click(TObject *Sender)
{
if (cdSendSelects->Checked)
{
RichEdit1->SelStart = 0;
RichEdit1->SelLength =0;
Memo1->SelStart = 0;
Memo1->SelLength =0;
}

if (cbSendScollCaret->Checked)
{
RichEdit1->Perform(EM_SCROLLCARET,0,0);
Memo1->Perform(EM_SCROLLCARET,0,0);
}

if (cbSetFocus->Checked)
{
if (rbEndWithFocusOnRichEdit->Checked) RichEdit1->SetFocus();
else Memo1->SetFocus();
}

}


JD wrote:
Quote:
Daniel Mayo <dmayo (AT) dickey-john (DOT) com> wrote:

RichEdit1->SelStart = 0;
RichEdit1->SelLength = 0;


While that will place the cursor at the start, you also need
to scroll the text so that the cursor is in view:

RichEdit1->Perform( EM_SCROLLCARET, 0, 0 );

~ 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.