 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
rob kemp Guest
|
Posted: Wed May 25, 2005 8:36 pm Post subject: Place the cursor at the begining of RichEdit1 |
|
|
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
|
Posted: Wed May 25, 2005 8:48 pm Post subject: Re: Place the cursor at the begining of RichEdit1 |
|
|
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
|
Posted: Thu May 26, 2005 6:31 am Post subject: Re: Place the cursor at the begining of RichEdit1 |
|
|
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
|
Posted: Thu May 26, 2005 6:20 pm Post subject: Re: Place the cursor at the begining of RichEdit1 |
|
|
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 |
|
 |
|
|
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
|
|