Recent

Author Topic: DbGRid how i can show Header of Column put in 2 rows  (Read 905 times)

eldonfsr

  • Sr. Member
  • ****
  • Posts: 456
DbGRid how i can show Header of Column put in 2 rows
« on: May 28, 2024, 11:32:26 pm »
Hello is possible in DBgrid columns headers on 2 lines title

ondrawcell  i get put information in to rows but not in title

Code: Pascal  [Select][+][-]
  1. procedure TFormPo.DBGDetPoDrawColumnCell(Sender: TObject; const Rect: TRect;
  2.   DataCol: Integer; Column: TColumn; State: TGridDrawState);
  3. begin
  4.  
  5.   if (Column.Index = 0 )then begin
  6.     DBGDetPo.Canvas.FillRect(Rect);
  7.     DBgDetPo.Canvas.TextOut(Rect.Left,Rect.Top,DBGDetPo.DataSource.DataSet.FieldByName('ItemNumber').AsString );
  8.     DBgDetPo.Canvas.TextOut(Rect.Left,Rect.Top+16,DBGDetPo.DataSource.DataSet.FieldByName('WareHouseCode').AsString );
  9.     DBgDetPo.Canvas.TextOut(Rect.Left+50,Rect.Top+16,DBGDetPo.DataSource.DataSet.FieldByName('UnitOfMeasure').AsString );
  10.   end;
  11.   if (Column.Index = 1 )then begin
  12.     DBGDetPo.Canvas.FillRect(Rect);
  13.     DBgDetPo.Canvas.TextOut(Rect.Left,Rect.Top,DBGDetPo.DataSource.DataSet.FieldByName('Description').AsString );
  14.     DBgDetPo.Canvas.TextOut(Rect.Left,Rect.Top+16,DBGDetPo.DataSource.DataSet.FieldByName('QtyOrdered').AsString );
  15.     DBgDetPo.Canvas.TextOut(Rect.Left+50,Rect.Top+16,DBGDetPo.DataSource.DataSet.FieldByName('QtyReceived').AsString );
  16.   end;
  17.   if (Column.Index = 3 )then begin
  18.     DBGDetPo.Canvas.FillRect(Rect);
  19.     DBgDetPo.Canvas.TextOut(Rect.Left,Rect.Top,DBGDetPo.DataSource.DataSet.FieldByName('UseTax').AsString );
  20.     DBgDetPo.Canvas.TextOut(Rect.Left+30,Rect.Top,DBGDetPo.DataSource.DataSet.FieldByName('RequiredDate').AsString );
  21.     DBgDetPo.Canvas.TextOut(Rect.Left,Rect.Top+16,DBGDetPo.DataSource.DataSet.FieldByName('QtyBckOrdrd').AsString );
  22.     DBgDetPo.Canvas.TextOut(Rect.Left+50,Rect.Top+16,DBGDetPo.DataSource.DataSet.FieldByName('UnitCost').AsString );
  23.   end;
  24.   if (Column.Index = 4 )then begin
  25.     DBGDetPo.Canvas.FillRect(Rect);
  26.     DBgDetPo.Canvas.TextOut(Rect.Left,Rect.Top,DBGDetPo.DataSource.DataSet.FieldByName('GLAccount').AsString );
  27.     DBgDetPo.Canvas.TextOut(Rect.Left,Rect.Top+16,DBGDetPo.DataSource.DataSet.FieldByName('QtyBckOrdrd').AsString );
  28.   end;
  29.  
  30. end;
  31.  
  32.  
I need put title of column  in two rows...

Zvoni

  • Hero Member
  • *****
  • Posts: 2410
Re: DbGRid how i can show Header of Column put in 2 rows
« Reply #1 on: May 29, 2024, 08:25:43 am »
i think to remember, there was a solution in the database-subforum, but no idea how far in the past that was.
IIRC, it had to do either with Fixed rows or with word-wrapping in a single cell
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

eldonfsr

  • Sr. Member
  • ****
  • Posts: 456
Re: DbGRid how i can show Header of Column put in 2 rows
« Reply #2 on: May 29, 2024, 04:06:53 pm »
Thanks Zvoni , I remember see something about that but now when i need i can find or remember where was... I think some body implement that and share info or tip about it...

Thanks..   

paweld

  • Hero Member
  • *****
  • Posts: 1061
Re: DbGRid how i can show Header of Column put in 2 rows
« Reply #3 on: May 30, 2024, 07:27:38 am »
RxDBGrid (RX components package) has the ability to multiline header
Best regards / Pozdrawiam
paweld

eldonfsr

  • Sr. Member
  • ****
  • Posts: 456
Re: DbGRid how i can show Header of Column put in 2 rows
« Reply #4 on: June 01, 2024, 05:18:20 am »
Wow RX never tried l lie that let me make test....

thanks...

 

TinyPortal © 2005-2018