|
|
You may also be able to do something so that the shortcut is delivered to your widget first, before it is tried on the scrollbar. First thing is to make sure your contents widget checks for the SHORTCUT event and consumes it (returns true). I vaguely remember this is intended to work.
If that does not fix it then I think the best approach is to subclass the parent of your widget and the scrollbar and make it's event handler deliver the SHORTCUT event to the widget first, returning true if that returns true. You can then call the base class with the events after that (it is true it will call your widget again with any SHORTCUT events that were ignored but this is harmless as your widget will ignore them a second time).
On 8/4/21 2:02 PM Dave Jordan wrote:
I'm using a hold browser and i
think its scrollbar is stealing a shortcut to a menu item i have
assigned to ctrl-end. How can I prevent this? subclass the
scrollbar? Or is it legit to have a handle and a callback for
the same widget i.e. the browser?
Yes, you can subclass and have a callback attached to the
widget. If you want to "filter" shortcuts (that can't be changed in
the base class you would subclass and define your handle() where
you'd test for the event in question and return 0 *before*
you call the handle() method of the base class, for instance
myclass::handle(int e) {
if (e == FL_SHORTCUT && Fl::key() == FL_END)
return 0;
return baseclass::handle();
}
In this case the FL_END keypress would be propagated to any other
widget that "wants" it.
Note: I can't tell if your assumption is correct, but if it is
something like the code above should help.
--
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/d5a5b77f-3d72-a769-c490-17d7bf1491c7%40online.de.
--
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/CAL-8oAhTyNcPACTJc70P7%2B4pRgV85LG%2Bww0iWVmPYyMHNDrfgA%40mail.gmail.com.
[ Direct Link to Message ] | |
|
| |