Board index » delphi » Disable rows or columns in TStringGrid

Disable rows or columns in TStringGrid

Hello,

Is is possible to disable in an TStringGrid an row or a column ?

And is it possible to insert an checkbox in an column (for al the rows).

Thanx Bruun

 

Re:Disable rows or columns in TStringGrid


Br...@tifajongbloed.nl (Bruun Jongbloed) wrote in <396f0287@dnews>:

Quote
>Hello,

>Is is possible to disable in an TStringGrid an row or a column ?

>And is it possible to insert an checkbox in an column (for al the rows).

>Thanx Bruun

Hello Bruun,

check out this freeware grid:

http://www.eye.ch/~mduerig/prog/index.html

It allows for much more than a checkbox. It even has an editor which is a
form. This means you can have celleditors only your imagination is the
limit to.

As for the disabled col.
If you want to hide it, set the width of the coloumn to -1.

If you just want it jumped over, do the following in the SelectCell of the
grid:

...
  CanSelect := True;
  if ACol = <the col(s) you want to skip> then
  begin
    CanSelect:=false;
    if ACol = <cols you want to jump over> then
      if ACol>=StringGrid1.Col then
        StringGrid1.Col:=ACol+1
      else
        StringGrid1.Col:=ACol-1;
  end;
...

This is just a simple example. Doesnt work for cells at start and end of a
row.

Hope this helps.

Jacob Pedersen
AK Techotel

Other Threads