Solved

selected in TEdit

Posted on 2013-01-29
4
583 Views
Last Modified: 2013-01-31
How can i test to see if something is selected (highlighted) in a TEdit ?  I am using a TEdit for numbers only
0
Comment
Question by:ChLa
[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
  • 2
4 Comments
 
LVL 1

Accepted Solution

by:
B-o-l-d earned 500 total points
ID: 38833934
hi chla,

you could test the member function SelLength. if you find something different than 0, you have selected text:

if myEdit.SelLength > 0 then begin
   DoSomething;
end;

refer also to SelStart and SelectAll.

cheers,
bold
0
 

Author Comment

by:ChLa
ID: 38834148
That should work. i will test it tomorrow and let you know. Thank you.

I had found SelectAll. What is SelStart ? Why are none of these things explained in the help files ?
0
 
LVL 27

Expert Comment

by:Sinisa Vuk
ID: 38834169
SelectAll is for highlight all text in edit and SelStart is similar to SelLength, it is greater than zero if you select some text in edit and represents start where selecting begins. It is in chars units. Some text is highlighted form SelStart and is long as SelLength.
0
 
LVL 1

Expert Comment

by:B-o-l-d
ID: 38834468
just to clarify:

SelectAll is a command (procedure/function) to select the whole text in the edit.

SelStart / SelLength are properties to read or write to look, whats selected or to set a selection. hereby points SelStart to the first character in the edit component, that is selected and SelLength tells you how many characters are selected.

copy(MyEdit.Text, MyEdit.SelStart, MyEdit.SelLength) gives you exactly the selected text from a edit box.

cheers,
bold
0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
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 you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses
Course of the Month6 days, 22 hours left to enroll

623 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