FLTK logo

Re: [fltk.general] Possible bug ? Fl_Browser_ Enter does not invoke callback function - A solution

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Library      Forums      Links      Apps     Login 
 All Forums  |  Back to fltk.general  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: Possible bug ? Fl_Browser_ Enter does not invoke callback function - A solution w1hkj Sep 10, 2020  
 

I really wanted to process ENTER, DELETE, LEFT and RIGHT keyboard events at the callback level

header file:


#ifndef FL_BROWSER2_
#define FL_BROWSER2_

#include <FL/Fl_Browser.H>

class Fl_Browser2 : public Fl_Browser
{
public:
    Fl_Browser2(int x, int y, int w, int h, const char* l = 0);
    int handle(int event);
};

#endif // FL_BROWSER2_


class implementation:


#include "flbrowser2.h"

Fl_Browser2::Fl_Browser2(int x, int y, int w, int h, const char* l)
: Fl_Browser(x, y, w, h, l)
{
}

int Fl_Browser2::handle(int event)
{
    int key = Fl::event_key();
    if (event == FL_KEYUP &&
        ( key == FL_Enter ||
          key == FL_Left ||
          key == FL_Right ||
          key == FL_Delete ) ) {
        do_callback();
        return 1;
    }
    return Fl_Browser::handle(event);
}


--
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/5c1332c4-ab3a-eb50-9a08-be1706f781ad%40bellsouth.net.
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

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'.