PDA

View Full Version : Reuse labels for different layouts or have separate?



zarkzervo
17th April 2009, 08:58
I have a combobox that decides what tools are available to the user.

e.g. "dynamic" will give the user this layout:
"left node" "right node"
combo combo

e.g. "Constant" will give the user this layout:
"node" combo

I also have others, but these two are most different. The first have two labels paired with their own combobox underneath and the second has a label paired with its own combobox on its right.

I now reuse the labels and comboboxes for each set so I first delete all widgets and recreate the ones I use and manually add them to a layout. The reason I delete them is to ensure that unmodified properties/attributes are reset. In the example above, the labels are horizontally centered in the first example but not adjusted in the second example.

I was wondering if it would be smarter to create a separate set of widgets and add them to their separate layouts and add this layout again to a higher layout. But then I have to manage the visibility of the widgets (layouts). What would be the best way to do that? Should I retrieve the children of each of the layouts and then call hide() on the children that are widgets?

I appologize for the somewhat messy question, but I hope someone understand what I'm asking for.