|
|
> I would not recommend adding FLTK widgets to Fl_Tree without
assigning them with widget().
Thanks again for the feedback! I am convinced that some of the
strange behaviors I've seen may very well be explained by failing
to use widget().
> as the tree doesn't know which item to associate the
widget with, and therefore where or when to draw it.
Maybe I'm missing something I should know ... I thought the
custom item drawing I'm doing was taking care of those concerns?
Drawing is one thing, but the xywh() position of the actual
widget is important for event
delivery (mouse entering/exiting the widget's xywh perimeter)
and Fl_Tree has to manage that
when the parent widget is resized/scrolled, or things like
margins and such are moved around.
Your custom drawing code should all be based around the widget's
own x()/y()/w()/h() which
Fl_Tree/Fl_Tree_Item will manage for you as long as the
association is made with widget().
Your widget draw code should NOT be based on external widget's
positions, such as the item's
label_x() / label_y() / etc. if you're implementing an actual
Fl_Widget derived widget.
Instead of using label_xywh() for your starting XYWH, you should
be using use x() / y() / w() / h(),
as drawing outside the widget's own xywh area is generally bad.
(An exception might be labels
intentionally drawn around the outside of the widget's
perimeter)
And you shouldn't have to be concerned with moving the widget's
position in the tree; as the parent,
Fl_Tree and Fl_Tree_Item should manage all that, provided it's
been told which item to associate
the widget with, which is done with Fl_Tree_Item::widget().
Arguably there should be an Fl_Tree_Item::begin() and
Fl_Tree_Item::end() to let you parent your
widget, just like other FLTK widgets, but for efficiency
Fl_Tree_Item is not derived from Fl_Widget.
--
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/ef24de7b-d25c-439d-0be5-4fee15dbfbf1%40seriss.com.
[ Direct Link to Message ] | |
|
| |