diff options
| author | Matthias Melcher <fltk@matthiasm.com> | 2009-04-12 20:00:45 +0000 |
|---|---|---|
| committer | Matthias Melcher <fltk@matthiasm.com> | 2009-04-12 20:00:45 +0000 |
| commit | ead9c2ce24c88523ebe9295015f993231a61b66a (patch) | |
| tree | 832c58415cf65e6017d0ebc777f8edee40e2e95e /src/fl_ask.cxx | |
| parent | afe1b90dd012216b007112dc5c92f22a1f034bd7 (diff) | |
Avoiding crashes for recrsive common dialogs (this does not fix the issue at hand yet) (STR #1986, 2150) / Added menu shortcut alignment for OS X / Fixed bad system menu hadling in OS X (STR #2153) / Fixed File Input mouse pointer dragging (STR #2181)
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@6757 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/fl_ask.cxx')
| -rw-r--r-- | src/fl_ask.cxx | 41 |
1 files changed, 35 insertions, 6 deletions
diff --git a/src/fl_ask.cxx b/src/fl_ask.cxx index 6dd1b7a4c..bc69ca57c 100644 --- a/src/fl_ask.cxx +++ b/src/fl_ask.cxx @@ -176,12 +176,15 @@ static int innards(const char* fmt, va_list ap, const char *b1, const char *b2) { + static char avoidRecursion = 0; + if (avoidRecursion) return -1; + avoidRecursion = 1; + makeform(); char buffer[1024]; if (!strcmp(fmt,"%s")) { message->label(va_arg(ap, const char*)); } else { - //: matt: MacOS provides two equally named vsnprintf's... ::vsnprintf(buffer, 1024, fmt, ap); message->label(buffer); } @@ -225,6 +228,8 @@ static int innards(const char* fmt, va_list ap, Fl::grab(g); message_form->hide(); icon->label(prev_icon_label); + + avoidRecursion = 0; return r; } @@ -288,7 +293,11 @@ void fl_beep(int type) { } #endif // WIN32 } -/** Shows an information message dialog box +/** Shows an information message dialog box. + + \note Common dialog boxes are application modal. No more than one common dialog box + can be open at any time. Request for additional dialog boxes are ignored. + \param[in] fmt can be used as an sprintf-like format and variables for the message text */ void fl_message(const char *fmt, ...) { @@ -304,6 +313,10 @@ void fl_message(const char *fmt, ...) { } /** Shows an alert message dialog box + + \note Common dialog boxes are application modal. No more than one common dialog box + can be open at any time. Request for additional dialog boxes are ignored. + \param[in] fmt can be used as an sprintf-like format and variables for the message text */ void fl_alert(const char *fmt, ...) { @@ -319,8 +332,12 @@ void fl_alert(const char *fmt, ...) { } /** Shows a dialog displaying the \p fmt message, this dialog features 2 yes/no buttons + + \note Common dialog boxes are application modal. No more than one common dialog box + can be open at any time. Request for additional dialog boxes are ignored. + \param[in] fmt can be used as an sprintf-like format and variables for the message text - \retval 0 if the no button is selected + \retval 0 if the no button is selected or another dialog box is still open \retval 1 if yes is selected */ int fl_ask(const char *fmt, ...) { @@ -337,11 +354,15 @@ int fl_ask(const char *fmt, ...) { /** Shows a dialog displaying the \p fmt message, this dialog features up to 3 customizable choice buttons + + \note Common dialog boxes are application modal. No more than one common dialog box + can be open at any time. Request for additional dialog boxes are ignored. + \param[in] fmt can be used as an sprintf-like format and variables for the message text \param[in] b0 text label of button 0 \param[in] b1 text label of button 1 \param[in] b2 text label of button 2 - \retval 0 if the first button with \p b0 text is selected + \retval 0 if the first button with \p b0 text is selected or another dialog box is still open \retval 1 if the second button with \p b1 text is selected \retval 2 if the third button with \p b2 text is selected */ @@ -377,9 +398,13 @@ static const char* input_innards(const char* fmt, va_list ap, } /** Shows an input dialog displaying the \p fmt message + + \note Common dialog boxes are application modal. No more than one common dialog box + can be open at any time. Request for additional dialog boxes are ignored. + \param[in] fmt can be used as an sprintf-like format and variables for the message text \param[in] defstr defines the default returned string if no text is entered - \return the user string input if OK was pushed, NULL if Cancel was pushed + \return the user string input if OK was pushed, NULL if Cancel was pushed or another dialog box was still open */ const char* fl_input(const char *fmt, const char *defstr, ...) { fl_beep(FL_BEEP_QUESTION); @@ -395,9 +420,13 @@ const char* fl_input(const char *fmt, const char *defstr, ...) { Like fl_input() except the input text is not shown, '*' characters are displayed instead. + + \note Common dialog boxes are application modal. No more than one common dialog box + can be open at any time. Request for additional dialog boxes are ignored. + \param[in] fmt can be used as an sprintf-like format and variables for the message text \param[in] defstr defines the default returned string if no text is entered - \return the user string input if OK was pushed, NULL if Cancel was pushed + \return the user string input if OK was pushed, NULL if Cancel was pushed or aother dialog box was still open */ const char *fl_password(const char *fmt, const char *defstr, ...) { fl_beep(FL_BEEP_PASSWORD); |
