CallOutBox dismiss behaviour


#1

Hello Jules,

the current CallOutBox::inputAttemptWhenModal() implementation consumes the dismissal click only if it happens inside the target area of the CallOutBox. Could this be optionally changed to always consume the click by simply calling dismiss()?

Thanks


#2

It took me a long time to get that behaviour right, it's done like that deliberately! I found that in most cases, having to click twice to dismiss the box and then click on something else was counter-intuitive.


#3

Yes, I understand this, but in my case the tipical click outside the CallOutBox would insert an unwanted item in a grid. Could you consider an optional flag to consent this behaviour?


#4

I had a very similar situation last week, but it's pretty easy to solve. In my case, my CallOutBox would affect the settings for something that I would be able to click on, potentially causing a clash.

I made the Component contained within my CallOutBox a ChangeBroadcaster. Then, in the destructor of that Component, I call sendSynchronousChangeMessage(), which informs the parent GUI (registered as a ChangeListener) that I'm in the process of clicking away from the CallOutBox. In my case, I use that trigger to reload the GUI, to ensure that it's picked up the updated values. In your example, you might just want to disable the grid and re-enable on a short timer instead?

P.S. This technique mimicked how the ColourSelector class works in Juce. Apologies to Jules if I've misrepresented the approach!


#5

Thanks w_ellis, I appreciate your help and your solution would work for sure, but it seems to me that adding a flag to CallOutBox would be quite easier and clean.


#6

OK, I have solved the problem using a transparent component that intercepts the clicks when a CallOutBox is showing.