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:
parent
3ec5c17bb1
commit
7429654b5e
1 changed files with 13 additions and 4 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue