This method works except for 1 UI flaw
and 1 obvious inefficiency, both of which are described
under switch(e)
I know can't be doing it quite right. I have tried
test_shortcut; no idea whether it's appropriate or
what is the correct usage.
All the shortcuts keys are created here
class Appmenu : public Fl_Menu_Bar {
public:
Appmenu(App *app) : Fl_Menu_Bar(...
dims ...) {
add("menu/save", FL_CTRL + 's',
save_cb, app); // app is the main and only application
window
Hmm, I must be missing
something.
IN that one
add("menu/save"..) line, FLTK has been told to invoke the
save_cb() method
if either the menu -> save is picked, or if someone
hits Ctrl-S.
So you're done right there, nothing
else to do.
Oh, and by nothing else to
do, I meant you don't need a handle() method at all
to make that work.
All the handling of the shortcuts has been defined already
in that one add() line,
and FLTK will invoke your callback functions (like
save_cb()) for you.
Comments are owned by the poster. All other content is copyright 1998-2025 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.