Fl::focus() returns the widget currently in focus.
If no widget is in focus, Fl::focus() returns NULL.
Docs for Fl::focus() are here:
https://www.fltk.org/doc-1.4/group__fl__events.html#ga7f0e9836db43268979e0b3a999583b7f
Some widgets can have focus but not have a "cursor", like
buttons and tabs.
If you're new to FLTK, read through the first sections of the
"FLTK Programming Manual"
which should cover things like focus in the "Handling Events"
section.
On 3/16/23 14:39, roger tunnicliffe wrote:
Thanks for the response. Fl_Focus is what I have been using but cannot get it to work. My code is:-(It acknowledges FunctionKey 2 and supplies an account search where someone can select an account for the Fl_Value_Input field win4_coa_key_acctno)
int eventHandler(int e, Fl_Window *w)
{
if ( e == FL_KEYDOWN )
{
int k = Fl::event_key();
if ((k==65471)||(k==65507))
{
Fl_Widget* rFocus = Fl::focus();
if (rFocus==win4_coa_key_acctno)
{
saveWindowNo=windowNo;
windowNo=99;
WIN99_ALL_ACCOUNTS();
}
}
On Friday, March 17, 2023 at 11:51:38 AM UTC+11 Greg wrote:
Also, might want to comment what those magic numbers are (65471, 65507)
to help us out here on the forum, as we're likely not gonna know which keys those are.
It's probably best to stick with the macro names defined in FL/Enumerations.H,
e.g. FL_Control_L, etc.
Everything follows the correct flow as it was run under gdb/ddd
3) Those magic numbers are the values indicated by FLTK. I havent used macro names because keyboards on ChromeOSare a little different so 65471 is what FLTK returns when FunctionKey 2 is pressed.