Alignment in TAdvStringGrid

Maybe a stupid question, but I can't find it anywhere:
How do I set the horizontal alignment of some of the Columns in the grid to something else than Left?
most of them will be Left, but the checkboxes must go Center and the dates Right.

You can use


grid.Alignments[col,row] := taCenter

or you can implement the event handler OnGetAlignment, for example:

procedure TForm1.AdvStringGrid1GetAlignment(Sender: TObject; ARow,
  ACol: Integer; var HAlign: TAlignment; var VAlign: TVAlignment);
begin
  if Acol = 3 then
    HAlign := taCenter;
end;

Ok, I'll try that.
So there is no defaultsetting possible for a certain column?

You'd need to use TAdvColumnGrid for that where you can do settings per column, i.e.

AdvColumnGrid.Columns[column].Alignment: TAlignment;

Ah, I did not know that one existed. I see on the website that it has the same features that the standard TAdvStringGrid has and more. I don't think there is much documentation though?

TAdvColumnGrid descends from TAdvStringGrid, so all that applies for TAdvStringGrid also applies for TAdvColumnGrid and as such, the 195 pages TAdvStringGrid developer guide http://www.tmssoftware.biz/Download/Manuals/TMS%20Grid%20Pack%20Guide.pdf applies as well as the 87 documented sample applications at: http://www.tmssoftware.com/site/gridpack.asp 

TAdvColumnGrid basically adds a Columns[] property to control settings per column.

I've just started using TAdvColumnGrid but setting the alignment via Columns property doesn't seem to have any effect on the first (fixed) row.  For now I have worked around this by using the Alignments property as well to set that row.  Is that the intended behaviour or a bug?

Was retested with a default TAdvColumnGrid on the form and the code:

procedure TForm1.FormCreate(Sender: TObject);
begin
  advcolumngrid1.Cells[1,1] := 'A';
  advcolumngrid1.Columns[1].Alignment := taCenter;
end;

and this shows the expected center alignment, so I cannot reproduce this.
What is different in your setup?
The cells in the "normal" area of the grid do align correctly.  The first (fixed) row does not.

procedure TForm1.FormShow(Sender: TObject);
var
  x: Integer;
begin
  for x := 0 to 4 do
    AdvColumnGrid1.Cells[x,1] := IntToStr(x);
  AdvColumnGrid1.Columns[3].Alignment := taRightJustify;
end;



The column header alignment is under

AdvColumnGrid1.Columns[3].HeaderAlignment := taRightJustify;

Ahh... good to know.  Thanks for the clarification.