?
Solved

tstringgrid with selected text

Posted on 2003-03-14
6
Medium Priority
?
1,017 Views
Last Modified: 2012-05-04
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
0
Comment
Question by:Chadak
[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
  • 3
  • 2
6 Comments
 
LVL 22

Expert Comment

by:Mohammed Nasman
ID: 8139588
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;
0
 
LVL 1

Author Comment

by:Chadak
ID: 8139630
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.
0
 
LVL 9

Accepted Solution

by:
mocarts earned 400 total points
ID: 8139833
implementation
type
  // dummy class to access protected sectoin of TStringGrid
  TMyStringGrid = class(TStringGrid)
  end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
  with TMyStringGrid(StringGrid1) do
    if EditorMode then
      Label1.Caption := InplaceEditor.SelText;
end;

wbr, mo.
0
Independent Software Vendors: 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!

 
LVL 9

Expert Comment

by:mocarts
ID: 8139850
this code can be executed from TMenuItem.OnClick as well.
mo.
0
 
LVL 1

Author Comment

by:Chadak
ID: 8144624
Im at home this weekend will try this monday morning
0
 
LVL 1

Author Comment

by:Chadak
ID: 8151789
thx works well
should have think of it
0

Featured Post

Industry Leaders: 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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses
Course of the Month8 days, 16 hours left to enroll

764 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