Olaf Krumnow - 2002-11-18

I'm thinking about how to calculate min and freferred sizes for a combo box. Following ideas came to my mind:

1) Just like LayoutTextBox, calculate sizes based on the space of a fixed amount of characters.
2) Calculate preferred size so that the ComboBox can display the longest entry in its items collection. Min size like 1).
This has some sub-ideas:
2a) calculate every time the preferred size is asked for, so that the longest entry has always enough space
2b) recalculate every time the items collection (or datasource resp.) changes
2c) Let the programmer decide when to calculate the preferred size (by providing a method), and fix this value, until it is requested to recalculate. If it is not requested to calculate, use one of the other strategies.

3) Any other ideas?

Currently I would prefer 2c) combined with 1)

What do you think?

Should a ListBox/CheckedListBox work similarly?

Olaf