Solved

Knowing on which character is klicked

Posted on 2002-06-19
5
144 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
[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 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

Technology Partners: 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

Suggested Solutions

Title # Comments Views Activity
find a node in VST 2 92
Dev express lookupcombo 3 64
Twebbrowser in Fire monkey android scrolling to bottom 1 85
DBCtrlGrid, Delphi, Scroll 8 85
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
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…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

734 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