Does anyone has a good idea how to calculate the min/pref/max sizes of a treeview, a listview or a datagrid?
Max should be unlimited I think.
Min could be a rather small value by default.
But pref makes it a bit painful.
Preferably it should be a size to display all data in the current state, ie. in a treeview all nodes that are not under a collapsed tree node should be visible. But that means preferred size changes every time a node is expanded/collapsed/added/removed. This could end in a very "flippy" layout. Guess a panel with a border layout, a treeview in the WEST and a detail page in the CENTER. On every resize of the panel the CENTER will be perhaps dramatically resized if the tree was expanded or collapsed.
What about a kind of programmatic fix of the size, ie. a function call that performs a size calculation and uses the result as the pref size as long as this function is not called again? Something like the idea I tried with the ComboBox. Perhaps the same settings? Make these setting a global enum for use in other controls?
The longer I think about it the more I like it.
The next problem is how to calculate the size a treeview needs to display all nodes. Anyone any ideas?
I don't know if the things about treeviews are true for listviews and datagrids as well.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Does anyone has a good idea how to calculate the min/pref/max sizes of a treeview, a listview or a datagrid?
Max should be unlimited I think.
Min could be a rather small value by default.
But pref makes it a bit painful.
Preferably it should be a size to display all data in the current state, ie. in a treeview all nodes that are not under a collapsed tree node should be visible. But that means preferred size changes every time a node is expanded/collapsed/added/removed. This could end in a very "flippy" layout. Guess a panel with a border layout, a treeview in the WEST and a detail page in the CENTER. On every resize of the panel the CENTER will be perhaps dramatically resized if the tree was expanded or collapsed.
What about a kind of programmatic fix of the size, ie. a function call that performs a size calculation and uses the result as the pref size as long as this function is not called again? Something like the idea I tried with the ComboBox. Perhaps the same settings? Make these setting a global enum for use in other controls?
The longer I think about it the more I like it.
The next problem is how to calculate the size a treeview needs to display all nodes. Anyone any ideas?
I don't know if the things about treeviews are true for listviews and datagrids as well.