?
Solved

Text Highighting

Posted on 2001-07-24
5
Medium Priority
?
163 Views
Last Modified: 2010-04-04
I have an app where I would like to highlight a section of text in an Edit box, I know how to highlight the whole text (by drawing the text), however am unsure as to how I can highlight a section.

Any Ideas?
0
Comment
Question by:mattlaver
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 11

Accepted Solution

by:
robert_marquardt earned 200 total points
ID: 6312296
Setting the properties SelStart and SelLength is the correct way to highlight text in a TEdit. See Delphi help for a sample.
If you use a Windows edit box then send a EM_SETSEL message to the control. See Windows SDK help.
0
 
LVL 2

Expert Comment

by:bugroger
ID: 6313178
hi,

try this:

// HighLightText(Edit1, 1, 3);
Procedure HighLightText(Edit : TEdit; nStart, nEnd : Integer);
Begin
 Windows.SetFocus(Edit.Handle);
 Edit.Perform(EM_SetSel, nStart-1, nEnd);
End;

GL
BUG
0
 
LVL 22

Expert Comment

by:Mohammed Nasman
ID: 6314126
Hello

  Try that by send message  EM_SETSEL

  Edit1.SetFocus;
  SendMessage(Edit1.Handle, EM_SETSEL, 2, 7);

Best regards
Mohammed Nasman
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6321102
and what about

Edit1.Selstart := 2;
Edit1.SelLength := 7;
0
 
LVL 1

Author Comment

by:mattlaver
ID: 6326127
Thanks, should have known...
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses
Course of the Month11 days, 23 hours left to enroll

752 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