Solved

How to retrieve text from TStringGrid when select it

Posted on 2008-06-22
2
1,245 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
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

708 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

16 Experts available now in Live!

Get 1:1 Help Now