• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2658
  • Last Modified:

Stringgrid read only column

Is there a way to set a column in a stringgrid to read only and not allow it to be selected?
0
brettawv
Asked:
brettawv
  • 3
  • 2
1 Solution
 
aubsCommented:
Look at the OnSelectCell Event for the grid:

procedure TForm1.StringGrid1SelectCell(Sender: TObject; ACol,
  ARow: Integer; var CanSelect: Boolean);
begin
      if Acol=2 then CanSelect:= False;
end;
0
 
intheCommented:
hi,
sure you can do this:

procedure TForm1.StringGrid1SelectCell(Sender: TObject; ACol,
  ARow: Integer; var CanSelect: Boolean);
begin
// if column 2 is our read only column
if (acol = 2)  then canselect := false;
end;

Regards Barry
0
 
intheCommented:
:-)) too slow.
0
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

 
aubsCommented:
Hi Barry

:-)
0
 
brettawvAuthor Commented:
Thanks.  I still need to know how to set focus to a different a cell. Can you help?
0
 
aubsCommented:
You could try using the stringrid.selection property.

Regards
Aubs
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now