FLTK logo

[master] 6d9df07 - GitHub #327: menu buttons will no longer grab arrow keys.

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.commit  ]
 
Previous Message ]Next Message ]

[master] 6d9df07 - GitHub #327: menu buttons will no longer grab arrow keys. "Matthias Melcher" Dec 17, 2021  
 
commit 6d9df0763fcb5a60e229ce270352d57da2d88abb
Author:     Matthias Melcher <git@matthiasm.com>
AuthorDate: Fri Dec 17 19:37:34 2021 +0100
Commit:     Matthias Melcher <github@matthiasm.com>
CommitDate: Fri Dec 17 19:48:59 2021 +0100

    GitHub #327: menu buttons will no longer grab arrow keys.
    
    In Fluid, selecting a menu button, and selecting it again to make it
    movable would also grab the text input focus, which would prevent
    the enclosing window from using arrow key events to manipulate
    the selected widget.

 fluid/Fl_Menu_Type.cxx | 2 ++
 test/preferences.fl    | 7 +++----
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git fluid/Fl_Menu_Type.cxx fluid/Fl_Menu_Type.cxx
index d05f7ea..d7e5fc5 100644
--- fluid/Fl_Menu_Type.cxx
+++ fluid/Fl_Menu_Type.cxx
@@ -485,6 +485,7 @@ Fl_Type* Fl_Menu_Type::click_test(int, int) {
   w->value((Fl_Menu_Item*)0);
   Fl::pushed(w);
   w->handle(FL_PUSH);
+  Fl::focus(NULL);
   const Fl_Menu_Item* m = w->mvalue();
   if (m) {
     // restore the settings of toggles & radio items:
@@ -586,6 +587,7 @@ Fl_Type* Fl_Input_Choice_Type::click_test(int, int) {
   w->value((Fl_Menu_Item*)0);
   Fl::pushed(w);
   w->handle(FL_PUSH);
+  Fl::focus(NULL);
   const Fl_Menu_Item* m = w->mvalue();
   if (m) {
     // restore the settings of toggles & radio items:
diff --git test/preferences.fl test/preferences.fl
index bdf46d0..b28e0c0 100644
--- test/preferences.fl
+++ test/preferences.fl
@@ -45,7 +45,7 @@ Function {} {open return_type int
   Fl_Window myWindow {
     label {My Preferences}
     callback closeWindowCB open
-    xywh {408 202 298 311} type Double hide
+    xywh {586 277 298 311} type Double visible
   } {
     Fl_Button {} {
       label Cancel
@@ -62,7 +62,7 @@ Function {} {open return_type int
       xywh {20 30 115 225} box ENGRAVED_FRAME align 5
     } {
       Fl_Input wAlarm {
-        label {Alarm at:}
+        label {Alarm at:} selected
         xywh {25 55 45 20} align 5
       }
       Fl_Choice wAmPm {open
@@ -268,8 +268,7 @@ Fl_Preferences app( Fl_Preferences::USER, project, application );
     eat.get( "binFoo", (void*)&hex, 0, 0, sizeof( unsigned int ) );
     void *data;
     eat.get( "binFoo2", data, 0, 0 );
-  **/} {selected
-  }
+  **/} {}
 }
 
 Function {writePrefs()} {open return_type void
Direct Link to Message ]
 
     
Previous Message ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.