Skip to main content
Participant
July 16, 2009
Answered

How to get hbox to relayout when children are hidden

  • July 16, 2009
  • 1 reply
  • 1316 views

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

This topic has been closed for replies.
Correct answer Simeon_Bateman

In addition to the visible property, you want to set the includeInLayout property.

This will allow those gaps to be eliminated as you discussed.  You can bind the includeInLayout property to the visible property in order to simplify that solution.

HTH

sim

1 reply

Simeon_BatemanCorrect answer
Inspiring
July 16, 2009

In addition to the visible property, you want to set the includeInLayout property.

This will allow those gaps to be eliminated as you discussed.  You can bind the includeInLayout property to the visible property in order to simplify that solution.

HTH

sim

Participant
July 19, 2009

I was looking all over the parent container for the right property.  Here it was on the child.  doh!  Worked like a charm!

--Thanks!