Topic: Adjust the column widths of a table grid.

Hello everyone! I have a project that includes a table grid, and I can't adjust the columns to the column content or column titles. I've already used BestFitColumns(), with bfBoth and bfHeader in procedure...tablegrid_OnChange. A native feature (I think it's native) of the table grid is to "remember" the column sizes after real-time adjustment by the user. Even that isn't working... I've also considered storing the column sizes in a table as they are adjusted, which would solve any similar problem. If anyone can help, I would appreciate it.

Roberto Alencar

Re: Adjust the column widths of a table grid.

Olá Roberto,
Como vai você?
I vaguely remember having a similar problem a few years back but can't remember any details sad.
Maybe if you can attach your project, someone might be able to spot the reason (but you're right - normally it would remember column widths from the previous session).
Derek.

Re: Adjust the column widths of a table grid.

derek wrote:

Olá Roberto,
Como vai você?
I vaguely remember having a similar problem a few years back but can't remember any details sad.
Maybe if you can attach your project, someone might be able to spot the reason (but you're right - normally it would remember column widths from the previous session).
Derek.


Hi Derek, I'm doing well and I hope you are too. I managed to get the BestFitColumns(bfBoth) command working. The problem was that I placed this command in procedure_tablegrid_OnChange (which is correct), but it had no effect because the record was being loaded via script through procedure_tablegrid_OnCellClick. After placing it in procedure_tablegrid_OnCellClick, everything went back to normal. Thank you for your attention!

Roberto Alencar

Re: Adjust the column widths of a table grid.

Setting Column Width

My Visual Database has the ability to manually adjust column widths for each table view. But in some cases, you want more intelligent behavior: automatic alignment of the data width or alignment of the width when the table size is changed. Using scripts you can achieve the desired effect.


I bring to the attention of readers several scripts that will allow the user to independently select the level of automation for column alignment he needs from four available options:


Default – manual alignment
Proportional – equal width for all columns, retained when the table size is changed
According to data – the width is set so that all data is displayed entirely, without cropping
Stretch last – the last column is stretched and fills the visible area of the table


https://k245.ru/en/mvdb-en/setting-column-width.html

Визуальное программирование: блог и телеграм-канал.

Re: Adjust the column widths of a table grid.

k245 wrote:

Setting Column Width

My Visual Database has the ability to manually adjust column widths for each table view. But in some cases, you want more intelligent behavior: automatic alignment of the data width or alignment of the width when the table size is changed. Using scripts you can achieve the desired effect.


I bring to the attention of readers several scripts that will allow the user to independently select the level of automation for column alignment he needs from four available options:


Default – manual alignment
Proportional – equal width for all columns, retained when the table size is changed
According to data – the width is set so that all data is displayed entirely, without cropping
Stretch last – the last column is stretched and fills the visible area of the table


https://k245.ru/en/mvdb-en/setting-column-width.html


Hi K245, thanks for replying! I still have a lot to learn about MVD. I'm not a programmer and I create programs because I really enjoy programming, and with MVD, this happens empirically based on the wealth of knowledge available on the forum. But I realize that you, Sparrow, and Derek (sorry if I don't remember others) have a deep understanding of MVD. Thank you.

Roberto Alencar