Can Fl::event_text() be used for non-text keys?

4 views
Skip to first unread message

pvr...@btinternet.com

unread,
May 17, 2021, 3:57:11 AM5/17/21
to fltk.general
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?

Phil.

Manolo

unread,
May 17, 2021, 4:36:41 AM5/17/21
to fltk.general
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().

Philip Rose

unread,
May 17, 2021, 11:19:23 AM5/17/21
to fltkg...@googlegroups.com

<QUOTE>

 

From: Manolo
Sent: 17 May 2021 09:36
To: fltk.general
Subject: [fltk.general] Re: Can Fl::event_text() be used for non-text keys?

 

 

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.

 

</QUOTE>

 

Thanks Manolo,

 

I thought I had tested Fn + Up, but obviously not as I see it generates PgUp

 

Phil.

 

 

Reply all
Reply to author
Forward
0 new messages