How to retrieve column widths from TableHeaderComponent?


I’ve got a TableDataComponent in my app, and in the case that the user decides to manually change the column widths & positions, I’d like to be able to save the changes so that everything looks the same the next time the app starts.

Unfortunately, unless I modify the Juce src code, or subclass the TableHeaderComponent, I don’t see a way to retrieve the column widths.

Perhaps I’m missing something – could anyone help me out here?


BTW, what an awesome GUI development platform! I’m hooked!


Glad you’re enjoying it!

How bizarre that I never added a method to get a column width, and that no-one else has ever needed it! It’s a one-liner to add, I’ll do it right now before I forget…


Thanks very much!

I’ve put together a Juce table component that wraps a SQLite database, so you specify a SQL query in constructor for the component, and results go into the table, using combo boxes for ID fields that are linked to other tables, and edit boxes for all the other fields. It handles updates to the database if you make changes. Anyway, it basically works now, but when it’s all exactly to my liking I’ll share if you’re interested in adding it to Juce.


Sounds like a good widget - thanks for the offer, but I wouldn’t want to add a dependency on sqlite to the library itself. Might be worth posting a link to share with other people though!