1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Fixed the FlexBox demo to make it update properly

This commit is contained in:
jules 2018-01-09 09:05:17 +00:00
parent 3ec5c17bb1
commit 7429654b5e

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;