Subject RE: [IBO] How to change text alignment of each column in TIB_Grid?
Author Alan McDonald
> I have not gtaColumns in TitleAlignment(TIB_Grid) property...actualy I
> have Left, Center, Right options.
> I want align to right each column title on decimal and integer
> fields!That is the point!
>
> glyphs are disappeared when you trie to do all thing in DrawTitle
> event...even if you use 1/2 width of rectangle...
>
> procedure TfrmClanovi.grdClanoviDrawTitle(Sender: TObject; ACol,
> ARow: Integer; Rect: TRect; State: TGridDrawState);
> begin
> with (Sender as TIB_Grid) do
> begin
> if (DataCol[ACol] = 0) then
> begin
> Canvas.Brush.Color := clBtnFace;
> Canvas.FillRect(Rect);
> Canvas.TextRect(Rect, Rect.Left, Rect.Top, 'Costumer ID');
> end;
> end;
> end;
>
>

certainly - if you draw the title yourself you will need to draw the glyph
yourself as well.
If it's a decimal field, they align right by default - so I don't understand
your problem unless you have a very old version which doesn't do this.
For my version, which is 4.5.Ai
Step1: Go to the IB_Query and set the field property Alignment property to
Right. If it's a decimal, set it's display format to
###,###,###.#0;; (note a space at the end of this string)
Step 2: Now go to the the grid and set TitleAlignment to gtaColumns - if no
gtacolumns then definitely something wrong with your version

Alan

>
>
> --- In IBObjects@yahoogroups.com, Helen Borrie <helebor@t...> wrote:
> >
> > At 03:44 PM 29/10/2005 +0000, you wrote:
> > >How to change text alignment of each column in TIB_Grid?
> > >Property TitleAlignment is not what I wont.I want align control for
> > >each column separately, whitout lose (up & down) order sign.
> >
> > Assuming you are talking about the title text, the only way I know to
> > control the horizontal alignment of the text column by column is to
> set the
> > alignment of the data column in the ib_query and then to set the grid's
> > TitleAlignment property to gtaColumns. Alignment should then follow
> what
> > you set for the field's alignment property.
> >
> > > whitout lose (up & down) order sign.
> >
> > Did you find that setting TitleAlignment to gtaColumns caused the
> ordering
> > glyphs to disappear?
> >
> > Helen
>