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?
brettawvAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
aubsConnect With a Mentor Commented:
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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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.

All Courses

From novice to tech pro — start learning today.