How to get hbox to relayout when children are hidden
I am using an HBox contrainer to layout action buttons along the bottom of a set of pages that make up a wizard. As a rule these pages are instantiated only once at wizard startup and persist throughout the life span of the wizard. During that time, a user can move back and forth a lot between pages. However based on the state of the the workflow, buttons on various pages will be disabled or re-enabled and some get completely hidden only to re-appear later. This happens dynamically based on use actions.
In this scenario, the disabled buttons look fine but hidden buttons mess things up. For example, if the third button in a row of four buttons is hidden, this results in an odd gap in the row of buttons. Likewise if the first of three buttons were to be hidden, the remaining two buttons are adjacent but not centered as they should be.
So my question is, is there anyway to remove a button from the layout without actually removing the button from the Hbox's list of children? Or is there any other means of having the layout be based only on the visible buttons? It this doable?
The reason I don't want to remove the button from the HBox entirely is then I would have to create a mechanism for keeping track of the correct sequence in which the buttons should appear so when they are added back in later, I can add them in the right location in the list of buttons. I can do this but I am hoping there is a built in solution.
--Ken
