Solved

StringGrid editing problem

Posted on 2011-09-05
2
461 Views
Last Modified: 2012-05-12
Hi all.
I have a StringGrid with two columns: in the first one there is a checkbox in the other one an empty string. I wish user be able to edit the second field only if the checkbox in the same row is checked. In other words, I have to make editable only one cell, not entire column.

Any idea?

Thanks in advance for your help.
0
Comment
Question by:Marco Gasi
2 Comments
 
LVL 22

Accepted Solution

by:
Ferruccio Accalai earned 500 total points
ID: 36484356
You could try this (make the cell editable just if the checkbox is checked)
procedure TForm1.StringGrid1SelectCell(Sender: TObject; ACol, ARow: Integer; var CanSelect: Boolean);
begin
  StringGrid1.Options := StringGrid1.Options - [goEditing];
  if StringGrid1.Objects[ACol-1, ARow] <> nil then
    if StringGrid1.Objects[ACol-1, ARow] is TCheckBox then
      if (StringGrid1.Objects[ACol-1, ARow] as TCheckBox).Checked then
        StringGrid1.Options := StringGrid1.Options + [goEditing]
end;

Open in new window

0
 
LVL 31

Author Closing Comment

by:Marco Gasi
ID: 36484510
Many thanks for your help. On to the next.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

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…
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 a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

777 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