NAME

Term::Fabulous::Event::Close - A dialog, a toast or a popup menu went away

SYNOPSIS

$dialog->on( Close => sub ($event) {
	$status->text('dialog closed');
	return;
} );

DESCRIPTION

A Term::Fabulous::Widget::Dialog fires Close on itself when it closes, whether the user pressed Escape or the program called $dialog->close. When the listeners run, the dialog is no longer part of the widget tree, and the keyboard focus has gone back to the widget that had it before the dialog opened, if that widget can still take the focus.

A Term::Fabulous::Widget::Toast fires it on itself when it goes away: when its timeout runs out, when the user clicks its close mark, or when the program calls $toast->hide.

A Term::Fabulous::Widget::Menu that was opened as a popup fires it on itself when it closes: when the user chooses an item, presses Escape or moves the focus elsewhere, or when the program calls $menu->close. A Term::Fabulous::Widget::Prompt fires it like every dialog, before its Answer.

The event has no fields of its own; $event->target is the dialog, the toast or the menu. It is a Clay::UI::Events::Event whose name is Close. The widget has no parent any more when it fires, so the event does not bubble anywhere. Listen on the dialog, the toast or the menu itself.

CONSTRUCTOR

new

my $event = Term::Fabulous::Event::Close->new;

Unknown parameters die. The name and bubble_mode parameters of Clay::UI::Events::Event are accepted.

SEE ALSO

Term::Fabulous::Widget::Dialog, Term::Fabulous::Widget::Toast, Term::Fabulous::Widget::Menu, Clay::UI::Events::Event, "Ask a question in a dialog (Dialog widget)" in Term::Fabulous::Cookbook::Forms.