Solved

StringGrid editing problem

Posted on 2011-09-05
2
482 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
[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 23

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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
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…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses
Course of the Month3 days, 13 hours left to enroll

630 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