Skip to content

Commit

Permalink
Make ofSystemTextBoxDialog return empty string on cancel. (#6155)
Browse files Browse the repository at this point in the history
Fixes #4945
#changelog #core
  • Loading branch information
ShadowMitia authored and arturoc committed Mar 22, 2019
1 parent cfc7d2d commit 9fc64fd
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions libs/openFrameworks/utils/ofSystemUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,9 @@ gboolean text_dialog_gtk(gpointer userdata){
gtk_widget_show_all (dialog);
if(gtk_dialog_run (GTK_DIALOG (dialog))==GTK_RESPONSE_OK){
dialogData->text = gtk_entry_get_text(GTK_ENTRY(textbox));
}
} else {
dialogData->text = "";
}
gtk_widget_destroy (dialog);
dialogData->mutex.lock();
dialogData->condition.notify_all();
Expand Down Expand Up @@ -638,6 +640,8 @@ string ofSystemTextBoxDialog(string question, string text){
// if OK was clicked, assign value to text
if ( returnCode == NSAlertFirstButtonReturn )
text = [[label stringValue] UTF8String];
else
text = "";
}
#endif

Expand Down Expand Up @@ -747,7 +751,7 @@ string ofSystemTextBoxDialog(string question, string text){
}else if((Msg.hwnd == cancelButton && Msg.message==WM_LBUTTONUP) || (Msg.message==WM_KEYUP && Msg.wParam==27)){
EnableWindow(WindowFromDC(wglGetCurrentDC()), TRUE);
DestroyWindow(dialog);
return text;
return "";
}

if (!IsWindow( dialog )){
Expand Down

0 comments on commit 9fc64fd

Please sign in to comment.