Solved

How to retrieve text from TStringGrid when select it

Posted on 2008-06-22
2
1,253 Views
Last Modified: 2010-04-21
I have a stringgrid named 'Sg1'

It has 6 columns and many rows depending on data loaded into it.  I need to be able to click any cell in column 0 and have the text returned as a string.
For eg:

Title                        Genre                     Actor(1)                    Actor(2)                  Actor(3)                  Location                    Mad Max                Action                     Mel Gibson               Tina Turner                                              Home

I have the top row fixed and the next row(s) has the data in them.  I need to be able to click on any cell in Col(0) the title column and have delphi return a string of the text that is in that cell.  So if a user clicks on cells[0,5] it will show me/them the text in that cell but if they click on cells[1,5] it will not do anything.  I only need col '0' to be active.

Thanks in advance
0
Comment
Question by:Mark Brady
[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
2 Comments
 
LVL 17

Accepted Solution

by:
mokule earned 100 total points
ID: 21840376
procedure TForm1.StringGrid1Click(Sender: TObject);
begin
  if StringGrid1.Col = 0 then
    Label1.Caption := StringGrid1.Cells[0,StringGrid1.Row];
end;
0
 
LVL 20

Author Closing Comment

by:Mark Brady
ID: 31469522
I can't believe it was that wasy.  Thanks Mokule !
0

Featured Post

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Suggested Courses
Course of the Month11 days, 3 hours left to enroll

631 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