Link to home
Start Free TrialLog in
Avatar of Chadak
Chadak

asked on

tstringgrid with selected text

heya delphi 6 and win2k

   i have a tstringgrid, is there a way to know the selected cell and the selected text inside a cell, i mean if inside the cell there is "hello wolrd" and the "llo wor" is blue and selected is there a way to know that selection. taking another component might not be an issue here.

thx
chad
Avatar of Mohammed Nasman
Mohammed Nasman
Flag of Palestine, State of image

Hello

  Use the Cells proeprty to return the text in specific cell, here's an example will Show you the content of selected cell, using the OnSelectCell even

procedure TForm1.StringGrid1SelectCell(Sender: TObject; ACol,
  ARow: Integer; var CanSelect: Boolean);
begin
  ShowMessage(StringGrid1.Cells[ACol,ARow]);
end;
Avatar of Chadak
Chadak

ASKER

sorry maybe i didnt ask my question well, i knew how to get this, but how can i know what part of the text was selected with the mouse and is hightlited blue.

because i have a grid with a popupmenu, and at some moment i rightclick, pop my menu, and i need to so something with the selected value inside the cell. the cell might have 10 words in it and only 2 words might be selected and i want to get those 2 words.
ASKER CERTIFIED SOLUTION
Avatar of mocarts
mocarts

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
this code can be executed from TMenuItem.OnClick as well.
mo.
Avatar of Chadak

ASKER

Im at home this weekend will try this monday morning
Avatar of Chadak

ASKER

thx works well
should have think of it