Control the width of table columns programmatically

General TRichView support forum. Please post your questions here
Post Reply
Vitalii
Posts: 63
Joined: Sat Oct 20, 2018 2:55 pm

Control the width of table columns programmatically

Post by Vitalii »

Hi, I have a specific question about tables.

The editor has a TRVTableItemInfo table that contains TRVLabelItemInfo.

According to the program logic, I programmatically change TRVLabelItemInfo.Text twice. The first time, the width of the table columns automatically adapts to the wide text, which is normal. But when I change the text to a shorter one the second time, the width of the table columns remains large (automatic adjustment does not work). If I then edit something in the table with the cursor, the columns return to the correct sizes. How can I restore the width of the columns programmatically after the second change to TRVLabelItemInfo.Text?

All operations take place within TSRichViewEdit.CanUpdate := False .. True.
Vitalii
Posts: 63
Joined: Sat Oct 20, 2018 2:55 pm

Re: Control the width of table columns programmatically

Post by Vitalii »

The sequence of actions is as follows:

1. The table contains content (text) that changes programmatically.
2. The content increases > the table columns expand.
3. The content decreases > the table columns remain wide.
4. Task: adjust the width of the columns to the current size of the content

I wanted to save the table settings before the changes and restore them after the changes. But I couldn't find a method or property that is responsible for the exact width of the table columns. But it would be enough to simply change something “in the background” in the table to update the width of the columns, as happens when I edit the table manually.
Post Reply