Solved

Remove TRichEdit's Cursor.

Posted on 2003-11-14
11
292 Views
Last Modified: 2010-04-05
I placed a TRichEdit control into a form.  As the TRichEdit box will be set to read-only, I don't want a cursor keep flashing on the edit box.
Is it possible to remove this cursor?  How can I do that?

Thanks.

raymng
0
Comment
Question by:raymng
  • 4
  • 4
  • 2
  • +1
11 Comments
 
LVL 2

Expert Comment

by:j42
ID: 9747572
Place it on a panel and set TPanel.Enabled := False;
0
 

Expert Comment

by:Wyverex
ID: 9748114
@j42: That doesn't remove the cursor though.

Add the follwing line to your FormCreate for example:

YourRichEdit.Cursor := crNone;

crNone is not available in the object inspector so you have to set it programmatically.

Voilá! The cursor is hidden when moved over the rich edit.


regards
Wyverex
0
 

Author Comment

by:raymng
ID: 9753047
Wyverex:

Not the mouse cursor, I mean the "cursor" which keeps flashing when you are typing text in the edit box.

raymng
0
 

Expert Comment

by:lopardo2003
ID: 9753171
I would use a timer and use the following code:

HideCaret(MyRichEdit.Handle);
0
 

Author Comment

by:raymng
ID: 9753203
lopardo2003:

Could you further explain your idea? I dont' understand.
Thank you.

raymng
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 

Accepted Solution

by:
lopardo2003 earned 300 total points
ID: 9755330
Add a timer to your form (System page > Timer), select the timer and in the object inspector decrease the interval value (Interval = 10 works fine), now double-clic the timer and the procedure should be as follows:

procedure TForm1.Timer1Timer(Sender: TObject);
begin
  HideCaret(RichEdit1.Handle);
end;
0
 
LVL 2

Expert Comment

by:j42
ID: 9762173
> That doesn't remove the cursor though.
Yep, it does!
0
 

Author Comment

by:raymng
ID: 9844974
Thanks lopardo2003 and sorry for the late reply.
I think it is quite resource consuming by using a timer here.

 
0
 
LVL 2

Expert Comment

by:j42
ID: 9845191
What about my suggestion?
0
 

Author Comment

by:raymng
ID: 9849919
Thanks j42. Your solution is good if the TRichedit is only used for displaying something, because the user cannot work with the TRichedit anymore.

0
 
LVL 2

Expert Comment

by:j42
ID: 9850945
Yep, I understand. Copy and paste is disabled. Darn!
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
This video discusses moving either the default database or any database to a new volume.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now