I want an alertwindow to pop up when the user clicks on a button. The user then has the option to cancel or confirm the button click. But the alertwindow immediately returns 0 when it pops up. I need it to wait for the user to click a button in the alertwindow. How can i achieve that?
Here is my code:
std::cout << juce::AlertWindow::showOkCancelBox(juce::AlertWindow::WarningIcon, "Confirm disconnect", "Are you sure you want to disconnect? \n\nThis will kill all the audio that is controlled by OSC.", "Disconnect", "Cancel", nullptr, nullptr) << std::endl;
It’s actually JUCE_MODAL_LOOPS_PERMITTED=1, but I believe that this behaviour is no longer recommended, especially for plugins, and the advice has been to write your code to use Asynchronous AlertWindows and Dialogs, and callbacks to complete the operation that you are requesting user input on.