Solved

Knowing on which character is klicked

Posted on 2002-06-19
5
140 Views
Last Modified: 2010-04-04
Hello,

Here are some questions I can't find a solution for.

1) Is it possible to store ± 1100 characters in one string?

2) Is it possible when clicked (or doubleclicked) on a string (text.property) in an edit field, to know on which character (count?) you clicked.  By example: if the value of the text property of an editfield is 'Jenny Jones' and you clicked with your mousepointer on the letter 'o' that the result you get is 8 (8 character of the text.property).

3) If there is a solution for question 2, is it then also possible to use it in a grid.  So when you clicked that you know on which record and in that record on which field and on which (count) character in that specific field.

Al solutions welcome.

Ka1a.

PS sorry for my poor English.
0
Comment
Question by:ka1a
5 Comments
 
LVL 27

Accepted Solution

by:
kretzschmar earned 50 total points
ID: 7093393
1) yes
2) selstart is changed after one click->just get its value->pos := edit1.selstart+1; //selstart is zerobased
3) see 2, but not possible in all cases
0
 
LVL 17

Expert Comment

by:geobul
ID: 7093398
Hi,

1) Yes (up to 2MB)

2)
function GetClickedCharPos1(Sender: TObject): int64;
begin
  result := 0;
  if (Sender is TEdit) then
    result := (Sender as TEdit).SelStart + 1;
end;
// or
function GetClickedCharPos2(Sender: TObject): int64;
begin
  result := 0;
  if (Sender is TWinControl) then
    result := LoWord(SendMessage((Sender as TWinControl).Handle,EM_GETSEL,0,0)) + 1;
end;

procedure TForm1.Edit1Click(Sender: TObject);
begin
  ShowMessage(IntToStr(GetClickedCharPos1(Sender)));
end;

Regards, Geo
0
 
LVL 3

Expert Comment

by:lopem
ID: 7094959
listening
0
 

Author Comment

by:ka1a
ID: 7095082
Hi,

Thanks for the solutions.  That where the answers I was looking for.
It seems you both answered at the same time.  Is it possible for me to give you both 50 points and if yes, how do I have to do that.

Thanks.

Ka1a.
0
 
LVL 17

Expert Comment

by:geobul
ID: 7095121
Accept kretzschmar's comment as an answer here (50 points). He was the first who answered your question.

If you wish to give additional points to me, you may ask another question titled 'points for geobul'.

Regards, Geo
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

760 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

18 Experts available now in Live!

Get 1:1 Help Now