Re: [fltk.general] trying to emulate tab_nav(1)

GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.general  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: trying to emulate tab_nav(1) Greg Ercolano 07:25 May 05 top right image
 

On 5/5/21 2:08 AM, Dave Jordan wrote:

notes = new Fl_Text_Editor(x, y, w, h);
[..]
notes->wrap_mode(Fl_Text_Display::WRAP_AT_BOUNDS, 0);
Fl_Text_Editor::kf_ignore(notes, FL_Tab);    // compiles but does nothing as far as i can see. I am using 1.3.5 ABI 10300)


    kf_ignore() is a nop destination for keys to be ignored, it does not do anything or create mappings.
    Its use is to map keys to be ignored to it, so that it acts as a nop (no operation), such as in the default key mapping table:

// These are the default key bindings every widget should start with
[..]
  { FL_Escape,    FL_TEXT_EDITOR_ANY_STATE, Fl_Text_Editor::kf_ignore     },    // <<-- NOTE ITS USE HERE TO IGNORE Fl_Escape
  { FL_Enter,     FL_TEXT_EDITOR_ANY_STATE, Fl_Text_Editor::kf_enter      },
  { FL_KP_Enter,  FL_TEXT_EDITOR_ANY_STATE, Fl_Text_Editor::kf_enter      },
 
    To use it you'd use add_key_binding(), e.g.

    notes->add_key_binding(FL_Tab, 0, Fl_Text_Editor::kf_ignore);

    ..which is basically what Fl_Text_Editor::tab_nav(int) does; just check out its implementation:

void Fl_Text_Editor::tab_nav(int val) {
  if ( val )
    add_key_binding(FL_Tab, 0, kf_ignore);
  else
    remove_key_binding(FL_Tab, 0);
}
    See Fl_Text_Editor's docs for add_key_binding() to see how to bind/remap keys to different functions.

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/cc9314ca-c40d-83e6-1970-6a2315c3e7c2%40seriss.com.
Direct Link to Message ]
 
bottom left image   bottom right image
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2021 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.