summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthias Melcher <github@matthiasm.com>2025-07-09 11:42:29 +0200
committerMatthias Melcher <github@matthiasm.com>2025-07-09 11:42:33 +0200
commit5a574e8d9d4a9d697eddc477f5971a5bb8c05862 (patch)
tree7c8c0ae898a1d196dd873f8f2a938ac6e31823df /src
parent16aa61efb509a30d4353b7c6a219ceebe9138156 (diff)
Improve Fl_Button event handling documentation (#1267)
Diffstat (limited to 'src')
-rw-r--r--src/Fl_Button.cxx17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/Fl_Button.cxx b/src/Fl_Button.cxx
index 5d40c37da..fb70114d6 100644
--- a/src/Fl_Button.cxx
+++ b/src/Fl_Button.cxx
@@ -254,10 +254,19 @@ void Fl_Button::key_release_timeout(void *d)
Derived classes may handle this differently.
- A button may request callbacks with \p when() \p FL_WHEN_CHANGED,
- \p FL_WHEN_NOT_CHANGED, and \p FL_WHEN_RELEASE, triggering the callback
- reasons \p FL_REASON_CHANGED, \p FL_REASON_SELECTED,
- and \p FL_REASON_DESELECTED.
+ Calling `when()` will tell the button widget when to call the callback.
+
+ Setting `FL_WHEN_RELEASE` will call the callback only if the button value
+ changed. It's called during `FL_RELEASE` and `FL_KEYBOARD` events with
+ `FL_REASON_RELEASED` set as the callback reason.
+
+ Setting `FL_WHEN_CHANGED` will call the callback with `FL_REASON_CHANGED`
+ every time the value of the button changes during `FL_DRAG`, `FL_RELEASE`,
+ and `FL_KEYBOARD` events.
+
+ Setting `FL_WHEN_NOT_CHANGED` will trigger a callback during `FL_RELEASE`
+ events, even if the value of the button die *not* change. For radio buttons,
+ this is also true during `FL_KEYBOARD` events.
\param[in] X, Y, W, H position and size of the widget
\param[in] L widget label, default is no label