diff --git a/src/juce_appframework/gui/components/windows/juce_DialogWindow.cpp b/src/juce_appframework/gui/components/windows/juce_DialogWindow.cpp index 8f50527f39..ce6dd20174 100644 --- a/src/juce_appframework/gui/components/windows/juce_DialogWindow.cpp +++ b/src/juce_appframework/gui/components/windows/juce_DialogWindow.cpp @@ -91,21 +91,22 @@ private: }; -void DialogWindow::showModalDialog (const String& dialogTitle, - Component* contentComponent, - Component* componentToCentreAround, - const Colour& colour, - const bool escapeKeyTriggersCloseButton, - const bool shouldBeResizable, - const bool useBottomRightCornerResizer) +int DialogWindow::showModalDialog (const String& dialogTitle, + Component* contentComponent, + Component* componentToCentreAround, + const Colour& colour, + const bool escapeKeyTriggersCloseButton, + const bool shouldBeResizable, + const bool useBottomRightCornerResizer) { TempDialogWindow dw (dialogTitle, colour, escapeKeyTriggersCloseButton); dw.setContentComponent (contentComponent, true, true); dw.centreAroundComponent (componentToCentreAround, dw.getWidth(), dw.getHeight()); dw.setResizable (shouldBeResizable, useBottomRightCornerResizer); - dw.runModalLoop(); + const int result = dw.runModalLoop(); dw.setContentComponent (0, false); + return result; } diff --git a/src/juce_appframework/gui/components/windows/juce_DialogWindow.h b/src/juce_appframework/gui/components/windows/juce_DialogWindow.h index b45b8e1e8a..b2d42942ef 100644 --- a/src/juce_appframework/gui/components/windows/juce_DialogWindow.h +++ b/src/juce_appframework/gui/components/windows/juce_DialogWindow.h @@ -88,6 +88,8 @@ public: This will open and display a DialogWindow containing a given component, returning when the user clicks its close button. + It returns the value that was returned by the dialog box's runModalLoop() call. + @param dialogTitle the dialog box's title @param contentComponent the content component for the dialog box. Make sure that this has been set to the size you want it to @@ -106,13 +108,13 @@ public: @param useBottomRightCornerResizer if shouldBeResizable is true, this indicates whether to use a border or corner resizer component. See ResizableWindow::setResizable() */ - static void showModalDialog (const String& dialogTitle, - Component* contentComponent, - Component* componentToCentreAround, - const Colour& backgroundColour, - const bool escapeKeyTriggersCloseButton, - const bool shouldBeResizable = false, - const bool useBottomRightCornerResizer = false); + static int showModalDialog (const String& dialogTitle, + Component* contentComponent, + Component* componentToCentreAround, + const Colour& backgroundColour, + const bool escapeKeyTriggersCloseButton, + const bool shouldBeResizable = false, + const bool useBottomRightCornerResizer = false); //============================================================================== juce_UseDebuggingNewOperator