diff --git a/examples/Demo/Source/Demos/FlexBoxDemo.cpp b/examples/Demo/Source/Demos/FlexBoxDemo.cpp index a7a7c4bf59..e0837d06ea 100644 --- a/examples/Demo/Source/Demos/FlexBoxDemo.cpp +++ b/examples/Demo/Source/Demos/FlexBoxDemo.cpp @@ -74,9 +74,7 @@ struct DemoFlexPanel : public juce::Component te.onTextChange = [this, updateFn] { updateFn(); - - if (auto parent = getParentComponent()) - parent->resized(); + refreshLayout(); }; addAndMakeVisible (te); @@ -101,6 +99,11 @@ struct DemoFlexPanel : public juce::Component case 5: flexItem.alignSelf = FlexItem::AlignSelf::stretch; break; } + refreshLayout(); + } + + void refreshLayout() + { if (auto parent = getParentComponent()) parent->resized(); } @@ -263,7 +266,13 @@ struct FlexBoxDemo : public juce::Component tb->setButtonText (text); tb->setRadioGroupId (groupID); tb->setToggleState (toggleOn, dontSendNotification); - tb->onClick = fn; + + tb->onClick = [this, fn] + { + fn(); + resized(); + }; + tb->setBounds (x, y, 130, 22); addAndMakeVisible (tb); return *tb;