My application has a window with a ListBox inside which is filled with text that changes over time, therefore Listbox entries can have several length.
I'd like to make the window and the listbox width to change dynamically dependent on the listbox entries length (in number of characters).
As an example, if my listbox has several entries and the maximum lenght is 30 characters i want to make the window and its listbox larger in width than one window that which maixum lenght is 20 characters.
What is the best way to do this?