From 6f7e1f4fb7e1277b4e28a15874db449cef2d6bfc Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Fri, 17 Nov 2023 15:25:21 +0100 Subject: Enhance documentation of event processing --- FL/Fl_Widget.H | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'FL') diff --git a/FL/Fl_Widget.H b/FL/Fl_Widget.H index 55282857a..fb0f32eb0 100644 --- a/FL/Fl_Widget.H +++ b/FL/Fl_Widget.H @@ -259,6 +259,19 @@ public: your overridden method so that you don't short-circuit events that you don't handle. In this last case you should return the callee retval. + One exception to the rule in the previous paragraph is if you really + want to \e override the behavior of the base class. This requires + knowledge of the details of the inherited class. + + In rare cases you may want to return 1 from your handle() method + although you don't really handle the event. The effect would be to + \e filter event processing, for instance if you want to dismiss + non-numeric characters (keypresses) in a numeric input widget. You + may "ring the bell" or show another visual indication or drop the + event silently. In such a case you must not call the handle() method + of the base class and tell FLTK that you \e consumed the event by + returning 1 even if you didn't \e do anything with it. + \param[in] event the kind of event received \retval 0 if the event was not used or understood \retval 1 if the event was used and can be deleted -- cgit v1.2.3