Solved

selected in TEdit

Posted on 2013-01-29
4
574 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
  • 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 26

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Path  to current project in Delphi. 2 72
Delphi: how to implement a User Shortcut mapper? 1 95
Convert MS Word document to a PDF file 9 65
CheckListBox usage 3 51
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…
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…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

863 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

19 Experts available now in Live!

Get 1:1 Help Now