changeset 26036:fe29584dad35

msgbox.m: Close window when "enter", "return", "escape", "space" typed (bug #54942). * msgbox.m (cb_keypress): Use any (strcmp (...)) to check for one of the following keys to close window: "enter", "return", "escape", "space".
author Rik <rik@octave.org>
date Mon, 05 Nov 2018 11:11:47 -0800
parents 0a39db17170c
children 864448a7f347
files scripts/gui/msgbox.m
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/gui/msgbox.m	Mon Nov 05 11:07:10 2018 -0800
+++ b/scripts/gui/msgbox.m	Mon Nov 05 11:11:47 2018 -0800
@@ -278,9 +278,9 @@
   close (gcbf ());
 endfunction
 
-## Callback when key typed (close window on <RETURN>)
+## Callback when key typed (close window on activation of button)
 function cb_keypress (~, ev)
-  if (strcmp (ev.Key, "return"))
+  if (any (strcmp (ev.Key, {"enter", "return", "escape", "space"})))
     close (gcbf ());
   endif
 endfunction