FLTK logo

Re: [fltk.general] What is the right way to do these shortcuts?

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   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: What is the right way to do these shortcuts? Greg Ercolano May 12, 2021  
 

On 5/12/21 7:29 AM, Greg Ercolano wrote:

On 5/12/21 3:13 AM, Dave Jordan wrote:

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.

--
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/00a43163-5784-8315-74bc-6f79c5eddb8f%40seriss.com.
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

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