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..