FLTK logo

[branch-1.4] c730902 - Backport 5a574e8

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.commit  ]
 
[ Previous Message ] [ Next Message ]

[branch-1.4] c730902 - Backport 5a574e8 "Matthias Melcher" Jul 16, 2025  
 
commit c730902f842ecbc7db1678eedc46fb90c1d34b31
Author:     Matthias Melcher <github@matthiasm.com>
AuthorDate: Wed Jul 16 12:49:12 2025 +0200
Commit:     Matthias Melcher <github@matthiasm.com>
CommitDate: Wed Jul 16 12:49:12 2025 +0200

    Backport 5a574e8
    
    Improve Fl_Button event handling documentation (#1267)

 src/Fl_Button.cxx | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git src/Fl_Button.cxx src/Fl_Button.cxx
index 5d40c37..fb70114 100644
--- src/Fl_Button.cxx
+++ 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
[ Direct Link to Message ]
 
     
[ Previous Message ] [ Next Message ]
 
 

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