FLTK logo

Re: [fltk.general] fl_choice + keyboard behavior

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.general  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: fl_choice + keyboard behavior Bill Spitzak Jun 01, 2021  
 
Tried this on gnome, try "zenity --entry" for the best example. It appears they still have Return pushing the OK button and Escape pushing the Cancel button, no matter what widget has focus.

However "zenity --question --extra-button foo" shows three buttons where Return pushes the one with focus (and does nothing if the text label has focus which you can get with Tab) but Escape always pushes the "No" button.

I guess I can see an excuse for the different behavior depending on whether there is a text field or not, but it looks like this is not well decided. There appears to be no icon indicating Enter works.

FLTK used what was considered standard design for dialogs in 1995, based mosly on Macintosh with some Windows and general CDE behavior, and some influence from what Forms did before.

It would be nice I guess if Enter pushed the button with the selection if it was not used as a Shortcut by any other widget but I don't think the event delivery in FLTK is set up to do that.



On Mon, May 31, 2021 at 5:29 PM Dave Jordan <quantumnonlocality@gmail.com> wrote:


On Mon, May 31, 2021 at 4:00 PM Greg Ercolano <erco@seriss.com> wrote:

    With the following:

#include <stdio.h>
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/fl_ask.H>

int main() {
  switch ( fl_choice("Quit?", "No", "Yes", 0) ) {
    case 0: fprintf(stderr,"NO");  break;
    case 1: fprintf(stderr,"YES"); break;
  }
  return 0;
}

    To use keyboard focus to click No with the keyboard: Right Arrow, Spacebar
    because spacebar pushes the buttons.

    Enter always picks Yes because the Yes button is an Fl_Return_Button, as shown
    by the "Enter arrow" on the button, indicating Enter always accepts that key,
    and is the 'default'. (That's what makes it "the default")

    From the docs:

The Fl_Return_Button is a subclass of Fl_Button that generates a
callback when it is pressed or when the user presses the Enter key.


    Since fl_choice() and other members of fl_ask.h and fl_message.h are very simple
    alert dialogs that date back to early history of XForms and old gl forms compatibility,
    they are, well, "old". I rarely use them except for very quick applications, and usually
    for final releases, replace their use with my own dialogs.

    If you want more control over the dialogs (and most people do), you can make your
    own dialogs derived from Fl_Window + Fl_Button that can do whatever you want,
    and can have more modern iconography, copy/pastable dialog text, etc..
okay, that all makes perfect sense. I guess I will do just that.
In the short term, I also just realized that fl_choice("Quit?", "No", 0, "Yes")  disables any execution without clicking.
--
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/2c2a5e1a-2a2f-4e2f-cc48-3873b278511c%40seriss.com.

--
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/CAPdW6bLw9tKWJvfHZxd6TbEDw5KPK7dDEwatyzBb_uYg42zkig%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/CAL-8oAhYBcmAVK6FL9-gi7%2Bk0%3D9squDq%2Bz1VHuACmPK3mpjx-A%40mail.gmail.com.
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]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'.