popover hide / close event

371 views
Skip to first unread message

Philipp Kraus

unread,
Mar 25, 2015, 3:56:55 PM3/25/15
to control...@googlegroups.com
Hello,

I'm new with ControlsFX (8.20.8) and I would like to create a PopOver with:

final PopOver l_popover = new PopOver( p_node );

l_popover.setDetached( true );
l_popover.setDetachedTitle( p_title );
l_popover.setHideOnEscape( true );
l_popover.setAutoFix( true );

How can I catch the hide event? I would like to run some actions if the popover is hide.

Thanks a lot

Phil

samir.ha...@gmail.com

unread,
Mar 26, 2015, 6:09:54 AM3/26/15
to control...@googlegroups.com
Hi Philipp,

The PopOver is extending PopupControl so you have all the methods of PopupControl at your disposal.

Thus, you can simply do :
l_popover.setOnHidden(new EventHandler<WindowEvent>() {

           
@Override
           
public void handle(WindowEvent event) {
               
//Do stuff
           
}
       
});

to catch when the PopOver is hidden.

Don't hesitate to read the documentation about Event and PopupControl if you want more information.

https://docs.oracle.com/javafx/2/events/jfxpub-events.htm
http://docs.oracle.com/javase/8/javafx/api/javafx/scene/control/PopupControl.html
http://controlsfx.bitbucket.org/org/controlsfx/control/PopOver.html

Philipp Kraus

unread,
Mar 26, 2015, 9:13:48 AM3/26/15
to control...@googlegroups.com
Great thanks,

I don't see the setOnHidden method - my solution works

Phil
Reply all
Reply to author
Forward
0 new messages