On Monday, May 17, 2021 at 9:57:11 AM UTC+2 pvr...@btinternet.com wrote:
On my lap-top, the up/down/left/right keys are shared with PgUp/PgDn/Home/End functions. Some apps allow me to use Alt-R to select the second set of functions and I have coded that in my app using Fl::event_key() to detect I am holding Alt-R down while pressing the navigation key. Is there a way to use event_text() instead?
You should explore this question with the test/keyboard program built when building the FLTK library.
That program shows the effect of pressing any key on Fl::event_key(), Fl::event_text() and Fl::event_state().
You'll see that arrow and page keys don't put anything in Fl::event_text().
The OS, not FLTK, is responsible for attaching 2 effects behind a single key. On my
keyboard, pressing the "up arrow" key produces Fl::event_key() = FL_Up
while pressing "function" and the "up arrow" keys simultaneously produces Fl::event_key() = FL_Page_Up.
FLTK perceives the second situation exactly as with an extended keyboard equipped with 2 distinct keys.
Anyway, you should use Fl::event_state() to check for modifier keys (alt, ctrl, shift), not Fl::event_key().