I'm trying to intercept right click events on a Fl_Tree, and do different 
actions depending on the Fl_Tree_Item selected this way.

I've noticed that in the handle code of Fl_Tree a right click sets the 
corresponding Fl_Tree_Item as the local focus, but does not select it nor 
triggers a callback.

The problem is even if I were to reimplement handle() and make it trigger a 
callback, there would be no obvious way for me to get the focused item, since 
the pointer that holds that is private ( Fl::focus() only returns the Fl_Tree 
itself ), and I saw no method to recover it.

A possibility would be using a Fl_Button with no box ( otherwise it looks 
terrible ) for each item, and in their callback check if the mouse button 
clicked is left or right.

However one would need to directly click the ( boxless ) button to trigger its 
event, while right-clicking on the very far left of the element still focuses 
it ( and would not trigger the button ). I think this would give a strange 
feedback to the user, since visually he clicked it but nothing happened. And 
another problem of buttons as Fl_Tree_Items is that the text is not aligned 
perfectly, and looks odd with normal items.

Is there a straightforward way to do something like this? Thanks in advance.
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to