How to make "Floating" Panel?


#1

I want to have a "floating" panel, that is async.  

1) What do I use for the floating panel (DialogWindow or Viewport)? I don't want components underneath to be clickable. I don't want icon decorations either (typical dialog close icon).

2) How to detect when to close by either clicking outside panel, or hitting <esc>?

3) How to make the panel translucent?

 

 


#2

I think what you're essentially going for there is a CalloutBox. That deals with all the automatic closing when focus is lost. Of course you can change it's appearance to what you want with the LookAndFeel.


#3

Is there a Gallery of Widgets? I didn't know about CallOutBox... and probably a bunch of others, just what I see in the JUCE demo. 

I found ResizableWindow which I thought was the closest to what I need, but it doesn't have an asynch method, or a way to close itself automatically. If I use CallOutBox looks like I could subclass and paint it the way I want... Don't really want the arrow even.

Thanks!

 


#4

It seems odd to me that CallOutBox::launchAsynchronously deletes the component it contains. I have to create instances, register/deregister listeners, etc. I see ResizableWindow lets you specify if you want to delete the contained component or not. Am I missing something?


#5

You create a calloutbox and launch it asynchronously, so the caller can't delete the content - it makes sense for the box to be responsible for doing that.

It's different with ResizeableWindow because you tend to create a subclass, and that subclass could manage the lifetime of its content comp fairly easily (although TBH I don't think I've ever used one in that way).