Solved

StringGrid editing problem

Posted on 2011-09-05
2
454 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
Comment Utility
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 30

Author Closing Comment

by:Marco Gasi
Comment Utility
Many thanks for your help. On to the next.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
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…

743 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

18 Experts available now in Live!

Get 1:1 Help Now