Hi Werner,
so you need to distinguish "your" controls from "system" controls. Can
you mark your controls somehow? For instance by node property or style
or perhaps even userData or id?
Regards,
Pavel
On 27.5.2013 15:52, Werner Lehmann wrote:
That statement might have been too soon. Consider this FXML:
<ScrollPane>
<StackPane>
<Label text="foo"/>
</StackPane>
</ScrollPane>
SceneGraph looks like this:
ScrollPane
- ScrollPaneSkin
- StackPane
- StackPane
- Label
- LabelSkin
- LabeledText
A drag or mouse event with target "Label" (or below) would resolve to
the (Skinnable) Label, following the parent chain. However, if the
event target is one of the stackpanes I cannot distinguish "my"
stackpane from the one used by the scrollpane skin. Generally
speaking, any skinned node accepting arbitrary children would break
this approach.
Do you see an easy (centralized) way out, or would I have to register
event handlers on each target?
In the latter case I'd have the extra problem of knowing when to
unregister the event handlers on nodes in my subtree of the scene
graph. This might actually require to listen on all parent properties
of the parent chain, probably even with some weak-listeners :-(
Rgds
Werner
On 27.05.2013 14:26, Werner Lehmann wrote:
Thanks, Pavel. At least now I know that I am not reinventing a wheel and
actually have to check the parent chain of the drag target.
On 24.05.2013 13:32, Pavel Safrata wrote:
Hi Werner,
if you don't want to register handlers on the vbox children then yes,
this looks like the best thing to do - the system cannot tell which
node
in the target's parent chain is your desired target, you need to decide
that manually.
Alternatively, you can have a single handler using the event source and
register it directly to the children.
Regards,
Pavel