diff options
author | Angelo Naselli <anaselli@linux.it> | 2015-08-30 15:30:15 +0200 |
---|---|---|
committer | Angelo Naselli <anaselli@linux.it> | 2015-08-30 15:30:15 +0200 |
commit | f1f2d9626af2f6104d8b90bcb16aac5e2f7295a9 (patch) | |
tree | b2f74ecee04e81e700fc5bc271d51d8aaadafdbf /lib/ManaTools/Shared/GUI | |
parent | 71988e806a7aedc8aeb34022fbb64ac477ebbf6b (diff) | |
download | manatools-f1f2d9626af2f6104d8b90bcb16aac5e2f7295a9.tar manatools-f1f2d9626af2f6104d8b90bcb16aac5e2f7295a9.tar.gz manatools-f1f2d9626af2f6104d8b90bcb16aac5e2f7295a9.tar.bz2 manatools-f1f2d9626af2f6104d8b90bcb16aac5e2f7295a9.tar.xz manatools-f1f2d9626af2f6104d8b90bcb16aac5e2f7295a9.zip |
Added event_timeout rw attribute to GUI::Dialog to allow manage $yui::YEvent::TimeoutEvent
Diffstat (limited to 'lib/ManaTools/Shared/GUI')
-rw-r--r-- | lib/ManaTools/Shared/GUI/Dialog.pm | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/ManaTools/Shared/GUI/Dialog.pm b/lib/ManaTools/Shared/GUI/Dialog.pm index 45fc151f..428130af 100644 --- a/lib/ManaTools/Shared/GUI/Dialog.pm +++ b/lib/ManaTools/Shared/GUI/Dialog.pm @@ -23,6 +23,8 @@ my $dlg = ManaTools::Shared::GUI::Dialog->new( $ManaTools::Shared::GUI::Dialog::cancelButton, $ManaTools::Shared::GUI::Dialog::okButton, ], + event_timeout => 0, # optional nd rw timeout in msec during the waitForEvent() + # needs a ManaTools::Shared::GUI::Event to manage the $yui::YEvent::TimeoutEvent layout => sub { my $self = shift; my $layoutstart = shift; my $dlg = $self->dialog(); my $info = $self->info(); ... $self->addWidget('button1', $button, sub{...}, $backendItem1); }, restoreValues => sub { my $self = shift; $info = {}; ...; return $info }, result => sub { my $self = shift; ... }, @@ -140,6 +142,17 @@ has 'dialog' => ( }, ); +subtype 'TimeoutType' + => as Int + => where {($_ >= 0)}; + +has 'event_timeout' => ( + is => 'rw', + isa => 'TimeoutType', + lazy => 1, + default => 0, +); + our $mainDialog = 1; our $popupDialog = 2; @@ -406,7 +419,7 @@ sub call { # main loop while(1) { - my $yevent = $ydialog->waitForEvent(1000); + my $yevent = $ydialog->waitForEvent($self->event_timeout); last if (!$self->processEvents($yevent)); } |