Browse Source

Fixed the FlexBox demo to make it update properly

tags/2021-05-28
jules 7 years ago
parent
commit
7429654b5e
1 changed files with 13 additions and 4 deletions
  1. +13
    -4
      examples/Demo/Source/Demos/FlexBoxDemo.cpp

+ 13
- 4
examples/Demo/Source/Demos/FlexBoxDemo.cpp View File

@@ -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;


Loading…
Cancel
Save