What's the best way to create / dismiss a CallOutBox from a button?

What’s the best way to create / dismiss a CallOutBox from a button? I want it to appear when you press the button the first time and disappear when you press the button a second time.

Currently, the CallOutBox gets destroyed as soon as the button is mouseDowned on the second time, so if in my onClick I look to see if there is already a CallOutBox on screen there isn’t, so I end up recreating it.

Any ideas?

If you look inside CallOutBox::inputAttemptWhenModal(), you’ll see some comments in there about me trying to make sure it does that… If you take a look at how I tried to make it work, can you see why it’s failing for your use-case?

Hmm… ok. Must be something wrong with my code that’s detecting if the CallOutBox is still on the screen. I’ll look into it.

Ok, I actually took some time to look into this, I think I understand what it’s doing now. It only works if the CallOutBox has a parent set, it doesn’t work if the CallOutBOx is on the desktop. I fixed the test for if it’s over original location in CallOutBox::inputAttemptWhenModal(), but that still doesn’t fix it, it’s not eating the mouse event for some reason.

I can use a CallOutBox with a parent, so I’m not going to dig any further at this point.