diff options
| author | Albrecht Schlosser <albrechts.fltk@online.de> | 2025-07-24 15:40:18 +0200 |
|---|---|---|
| committer | Albrecht Schlosser <albrechts.fltk@online.de> | 2025-07-24 15:40:18 +0200 |
| commit | b00ae1eee42c102f577189e7fb095a4a4ea37f02 (patch) | |
| tree | ecaa4e537e576f27becd384043fd9bd10a65a739 | |
| parent | 890f538bb5cafafe40aa0c7d8ca1c31561c55761 (diff) | |
Fix documentation of fl_overlay_clear and fl_overlay_rect
The code example in fl_overlay_clear() wouldn't work.
| -rw-r--r-- | src/fl_overlay.cxx | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/fl_overlay.cxx b/src/fl_overlay.cxx index 82e4a1354..247a9111f 100644 --- a/src/fl_overlay.cxx +++ b/src/fl_overlay.cxx @@ -97,26 +97,26 @@ void fl_overlay_clear() { of the widget. Your event handle should look similar to this (also see `test/mandelbrot.cxx`): - ``` + \code int MyWidget::handle(int event) { - static int ix, iy; switch (event) { case FL_PUSH: - ix = Fl::event_x(); iy = Fl::event_y(); + ix = Fl::event_x(); // ix defined as (private) class member + iy = Fl::event_y(); // iy defined as (private) class member return 1; case FL_DRAG: - this->make_current(); - fl_overlay_rect(ix, iy, ix-Fl::event_x(), iy-Fl::event_y()); + window()->make_current(); + fl_overlay_rect(ix, iy, Fl::event_x() - ix, Fl::event_y() - iy); return 1; case FL_RELEASE: - this->make_current(); + window()->make_current(); fl_overlay_clear(); // select the element under the rectangle return 1; } return MySuperWidget::handle(event); } - ``` + \endcode \note Between drawing an overlay rect and clearing it, the content of the widget must not change. |
