DBGrid - Autosize column with double click on the columns splitter
Original Reporter info from Mantis: gaborboros @gaborboros-bgss
-
Reporter name: Gabor Boros
Original Reporter info from Mantis: gaborboros @gaborboros-bgss
- Reporter name: Gabor Boros
Description:
After digged into the grids sources found TDBGrid have autosize feature and TCustomGrid have autosize with double click feature. I worked out a solution for myself but with dirty hacks. In my dbgrid override AutoAdjustColumn which contains the modified version of TCustomDBGrid.UpdateAutoSizeColumns and autosize only one column at one time. After this hacked TCustomGrid.DblClick to call AutoAdjustColumn every time if Cursor=crHSplit because TDBGrid not have goDblClickAutoSize option (TCustomDBGrid.Options is TDBGridOptions and TCustomGrid.Options is TGridOptions).
I suggest split TCustomDBGrid.UpdateAutoSizeColumns into parts and make a public TCustomDBGrid.AutoSizeColumn(aCol: Integer). With this can resize one column at one time and can do this from code in runtime. But I not have idea for the option thing which control the autosize at double click.