Recent

Author Topic: DBGrid, the last column does not auto adjust  (Read 1152 times)

hamacker

  • Jr. Member
  • **
  • Posts: 58
DBGrid, the last column does not auto adjust
« on: August 15, 2024, 07:02:21 pm »
After I updated to Lazarus 3.4, the DBGrid has a strange behavior when I use predefined columns. Each TColumn has its own minimum and maximum width defined, with the exception of the last column. My intention is that when I redefine the window, the last column has the maximum available width. This worked correctly before, but now the last column only uses the available area if I increase the window too much.

See the link:
https://streamable.com/g44gpk (expire after 2 days)
https://terabox.com/s/1_9iHLxTIvdipc4OXAJ2pxQ

My DBGrid as:
  Grade_Pesquisa.FixedCols:=0;
  Grade_Pesquisa.DefaultRowHeight:=54;
  Grade_Pesquisa.AlternateColor:=clMoneyGreen;
  Grade_Pesquisa.BorderStyle:=bsNone;
  Grade_Pesquisa.AutoEdit:=false;
  Grade_Pesquisa.AutoFillColumns:=true;
  Grade_Pesquisa.Flat:=true;
  Grade_Pesquisa.TitleStyle:=tsNative;

  //Grade_Pesquisa.FixedHotColor:=clInfoBK;
  Grade_Pesquisa.UseXORFeatures:=false;
  Grade_Pesquisa.Options:=
    [dgTitles,dgColumnResize,dgColLines,dgColumnMove,dgAlwaysShowSelection,             // dgTabs
     dgCancelOnExit,dgHeaderPushedLook,dgDisableDelete,dgDisableInsert,
     dgCellHints,dgTruncCellHints,dgCellEllipsis,dgRowHighlight,
     dgDblClickAutoSize, dgDisplayMemoText];
  Grade_Pesquisa.Options:=ADBGrid.Options-[dgRowSelect];
  Grade_Pesquisa.ShowHint:=true;   
« Last Edit: August 15, 2024, 07:06:57 pm by hamacker »

hamacker

  • Jr. Member
  • **
  • Posts: 58
Re: DBGrid, the last column does not auto adjust
« Reply #1 on: August 15, 2024, 07:55:58 pm »
Reply to myself:
Last column (TColumn) need to be:
Min:=0;
Max:=0;

If you have min>0 or max>0, DBGrid will fail to elastic width.

I Have max:=0, but min >0, it's the problem!

 

TinyPortal © 2005-2018