Dismissing CallOutBox from it's own content

I have a simple TextButton, clicking it is supposed to allow renaming it. I like the tidy look, small form factor, and arrow of the CallOutBox. I make a component, add the TextEditor, Save and Cancel buttons and launchAsync a CallOutBox with that content like all the juce examples suggest.
How can I get it to dismiss when I click on the the buttons? It seems to only dismiss if user clicks anywhere else other than itself.

Maybe this will give you ideas… you’d have to derive your own class from CallOutBox…

Rail

I actually tried that first, but it got messy dealing with the launchAsync helper and who owns what pointers etc.

Trying to store a pointer to the CallOutBox that get’s generated by the launchAsync helper method also proved to be annoyingly painful.

But I found the way in another thread. You need to put a findParentComponentOfClass<CallOutBox>()->exitModalState(0); somewhere in the content that goes on the calloutbox and call it from there.
In the case of the OK | CANCEL setup like I need, onButtonClicked() is a good place for it.