I am trying to implement a component that will pop up when called similar to a PopOverController on iPad. Inside of this component is sliders, edit text, etc. If the user clicks outside of this component I want the view to go away. I know I can do this with popover window but I really need it to be inside of another component.
The idea is that something pops up, user edits, then clicks anywhere to get it to go away.
I have it mostly working. On creation of popup I enterModalState on the popup component and set Desktop::getInstance().addGlobalMouseListener(this);
On mouseDown I endModalState and removeGlobalListener and then hide my view. Works ok. But ultimately I would like it on mouseUp instead of mouseDown but while in a modal state the mouseUp events never get called. The reason for wanting the mouseUP is because the mouseUp event gets passed to whatever component the user clicked on outside of my popup component and really I want the event to be ‘eaten’.
Am I making this more complicated than it should be? This approach is quite elegant and works inside of the component without any real hacks to listen to other mouse events. But that mouseUP call is killing me