Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

selected in TEdit

Posted on 2013-01-29
4
Medium Priority
?
584 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 2000 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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

715 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