SetColumnWidth vs rDBGridsPropSave

44 views
Skip to first unread message

Thietbi Hanoi

unread,
Jun 19, 2022, 4:28:36 AM6/19/22
to Rosi Delphi Components
Hello,

If using both SetColumnWidth and  rDBGridsPropSave then only SetColumnWidth function has the effect. All column modification (e.g. width) stored in the PropSaveFile but has no effect to the Grid.

What I am testing is:
 - rDBGrids_MS component
 - SetColumnWidth(cwDataWidth, 2); //put in FormShow

Thank you in advance for your advise.

Tomas Rosinsky

unread,
Jun 19, 2022, 11:50:15 AM6/19/22
to Rosi Delphi Components
Hello,

I'm sorry but the description of your issue is not clear for me so I cannot give you any valuable advice.
Please explain current and expected behavior.

Thanks
Tomas

Dne neděle 19. června 2022 v 10:28:36 UTC+2 uživatel hung1...@gmail.com napsal:

Thietbi Hanoi

unread,
Jun 20, 2022, 5:24:20 AM6/20/22
to Rosi Delphi Components
Good morning,

Thank you for your reply and I am also sorry for confusion.

Here is what I have been doing:

- The project works as expected when using the function  SetColumnWidth. All columns are adjusted automatically based on the data length in the field
- Next I wanted to test the PropSave by doing:

  1. Put the TPropSaveFile component in main form and set it: Compress + New_Name + UseAsGlobalFile
  2. Put the TPropSaveMain and TrDBGridsPropSave components in the child form which contains the TrDBGrid_MS
  3. Set  TPropSaveMain.PropSaveFile to the main form
  4. Set  TrDBGridsPropSave.Components with the name of TrDBGrid_MS
  5. Set  TrDBGridsPropSave.OnReadSavePropProp as it is used in your demo
  6. Run the project
  7. All columns are appeared to be adjusted by  SetColumnWidth function
  8. Manually change some column widths
  9. Exit project
  10. Check the PropSaveFile file in step 1 to be sure it stores some data of rDBGrid
  11. Re-run the project.
  12. The rDBGrid keeps the columns widths as step 7. In fact, it should change to what I have done in step 8 as expected

Please kindly advise.

Tomas Rosinsky

unread,
Jun 20, 2022, 6:53:09 AM6/20/22
to Rosi Delphi Components
Hi, thanks for deailed description.

There could be an issue with event order 
- the moment when the PropSaveMain set all setting 
- the moment when the grid columns are created.

The main question is if the Grid columns are persistent (created in the design time) or not. 
If it is not persistent  then it is created once dataset is opened and it could be later than PropSaveMain event.

Possible solution:
- check by debugger what is processed first and/or if the grid columns exists
- change PropSaveMain event from CreateDestroy to ShowHide or use None and call ReadProperties and SaveProperties events manually in some form event

Also please check value of the ColumnWidth property. If there is some value stored then it is restored and SetColumnWidth is called automatically.

I hope it helps
Tomas
Dne pondělí 20. června 2022 v 11:24:20 UTC+2 uživatel hung1...@gmail.com napsal:
Reply all
Reply to author
Forward
0 new messages