|
|
Is there also an example for Fl_Counter widget or related without the arrows ? The user can simply click and re-enter value or click and move mouse for the value to increase - depending on whether the movement is to the right or left ? Kind of like Fl_Scroller with an invisible scroll and just the value visible.
On Tuesday, October 19, 2021 at 11:46:33 PM UTC+5:30 er...@seriss.com wrote:
I am trying to create a widget that can be pointed into a box to
select the pixel co-ordinates within. It has a click box next to
it to activate the point selection crosshairs, and then the point
co-ordinates inside the box will be selected.
Any suggestions ?
I'd suggest deriving a widget from Fl_Group that implements
this pixel coordinate picking
behavior, handle() to track the mouse movement. If I remember
correctly, in response to
FL_ENTER, return 1 so your widget gets FL_MOVE events, which
gives tells you where the
mouse is whenever it moves. Save the x/y coords from FL_MOVE
in your widget and trigger
a redraw() so that your draw() routine can draw() the
crosshairs over the child widget.
Then your app can create this widget as the parent, and make
the widget with the
visual elements to be picked a child of that. (e.g. an Fl_Box
with an image() assigned to it)
For flexibility, you'd probably want to implement this
Fl_Group oriented widget
so that a callback can be set to get the 'picking' events, so
your app knows what to
do when something is "picked".
For drawing the cursor, you could try using the overlay
plane stuff, but these days
most machines are fast enough you can redraw the image/visual
element and draw
the cursor over that, redrawing each time the mouse FL_MOVE
events are received.
Just be sure to use an Fl_Double_Window so there's no flicker.
--
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/90d6fdb0-cc98-4dd4-a212-7cc82d80a15fn%40googlegroups.com.
[ Direct Link to Message ] | |
|
| |