When I add an alert window in the current develop branch, and add a custom component it will show the button text separately from the button. (See code/picture.)
juce::AlertWindow alert("Title","Message", juce::MessageBoxIconType::NoIcon, this); alert.addButton("Yes", 0); alert.addButton("No", 1); auto button = std::make_unique<juce::ToggleButton>("Don't ask again"); button->setBounds(0, 0, 300, 40); alert.addCustomComponent(button.get()); auto status = alert.runModalLoop();
If I add in
button->setName(""); to this code, it works as expected.
In juce::AlertWindow Line 352, there is a loop which goes through the custom components and draws fitted text, which is causing this issue. Is there a reason it does this?
Also, I would love to use the
showAsync call, but there is no option to add a custom component to the MessageBoxOptions. Would that be a possibility to add in the future, so I can remove the
JUCE_MODAL_LOOPS_PERMITTED flag from my project? Or add the ability to include a toggle button, to the alert window?