Subject Re: [IBO] Alignment of TIB_GRID title
Author paulphope
Geoff

Wouldn't it be nice if a TitleAlignment option was taColumns? I feel
sure such an enhancement would only take you 10 minutes :-)

Regards
Paul

> > I could not find out how to align the title of a tib_grid's column
> > according to it's contens. As the column contains numeric values I
> > want both the title of the column and it's data aligned right.
> > (title is allways aligned left)
>
> You can change the way ALL titles cells are aligned using
> TitleAlignment property.
>
> To change individual title alignment you must attach code to the
> OnDrawTitle event. This is not as difficult as it sounds because
> IB_Grid makes most of the required procedures public. So in your
event
> code you simply do something along the lines of...
>
> procedure TForm1.IB_Grid1DrawTitle(Sender: TObject; ACol,
> ARow: Integer; Rect: TRect; State: TGridDrawState);
> begin
> IB_Grid1.DefaultDrawTitle( ACol, ARow, Rect, State,
> IB_Grid1.GetCellDisplayText( ACol, ARow ),
> IB_Grid1.GetCellAlignment( ACol, IB_Grid1.FixedRows + 1 ) );
> end;
>
> In the above I cheat and simply tell the GetCellAlignment method
that
> I am looking for alignment in a row after the title - AFAICT this is
> safe.
>
>
> --
> Geoff Worboys - TeamIBO
> Telesis Computing