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.
--
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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/D6C4FE58-6C61-4F23-A0A2-E4E05F0CFCCB%40gmail.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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/2c2a5e1a-2a2f-4e2f-cc48-3873b278511c%40seriss.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/CAPdW6bLw9tKWJvfHZxd6TbEDw5KPK7dDEwatyzBb_uYg42zkig%40mail.gmail.com.
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.
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.