How to listen click events inside or outside the container?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How to listen click events inside or outside the container?

voger
I made this playground example to show what I am trying to do
http://tinyurl.com/pm6rvvb

This is a ContainerComposite that contains a ToolBar. The ToolBar itself
contains two buttons.

What I am trying to do is that no mater where I click __inside__ the
ContainerComposite, even the buttons, the container should listen the
click ("pointerdown") and call the callback function.

When I click __anywhere__ outside the container, be it the white space
or the third button, the ContainerComposite should detect the click,
determine that it is outside of it and act accordingly.

------------------------------------------------------------------------------
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to listen click events inside or outside the container?

voger
I made some progress with this. Here are the results
http://tinyurl.com/nnhr6st

The problem now is that in line 22 there is a conditional check that
calls twice the function targetInArray(target, array) defined in line
30. That function loops to check if the target is child of the container
or now. I don't think this is the proper way to do it because running
through loops every time there is a click would add much overhead.

Is there any better way to determine if the click has happened inside
the container or not? Or maybe a faster way to determine if the target
is somehow contained in that container. A way to determine a child/grand
child/grand grand child relationship maybe?

------------------------------------------------------------------------------
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Loading...