Games-Sudoku-Component-TkPlayer
view release on metacpan or search on metacpan
lib/Games/Sudoku/Component/TkPlayer/Selector.pm view on Meta::CPAN
}
sub keypress {
my $this = shift;
my $e = $this->XEvent;
if ($e->K eq 'Escape') { $this->{result} = 0 }
if (my ($num) = $e->K =~ /^(\d)$/) { $this->{result} = $num; }
}
sub Show {
my $this = shift;
$this->{old_focus} = $this->focusSave;
$this->{old_grab} = $this->grabSave;
$this->Popup(
-popover => $this->Parent,
-overanchor => 'c',
-popanchor => 'c',
);
$this->grab;
if (my $focusw = $this->cget(-focus)) {
$focusw->focus;
}
else {
$this->focus;
}
$this->Wait;
$this->{old_focus}->();
$this->{old_grab}->();
return $this->{result};
}
sub Wait {
my $this = shift;
$this->Callback(-showcommand => $this);
$this->waitVariable(\$this->{result});
$this->grabRelease;
$this->withdraw;
$this->Callback(-command => $this->{result});
}
}
1;
__END__
=head1 NAME
Games::Sudoku::Component::TkPlayer::Selector - UI class
=head1 SYNOPSIS
use Games::Sudoku::Component::TkPlayer::Selector;
my $popup = Games::Sudoku::Component::TkPlayer::Selector->new;
=head1 DESCRIPTION
This is an internal class.
=head1 METHODS
=over 4
=item set_allowed
turns the buttons you shouldn't push red if you enable "Allowed value only" option.
=item setsize
sets the size of the puzzle board (used internally).
=back
=head1 TK METHODS
Consult appropriate pods for details.
=over 4
=item Populate, Show, Wait, keypress
=back
=head1 AUTHOR
Kenichi Ishigaki, E<lt>ishigaki at cpan.orgE<gt>
=head1 COPYRIGHT AND LICENSE
Copyright (C) 2006 by Kenichi Ishigaki, all rights reserved.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
=cut
( run in 1.021 second using v1.01-cache-2.11-cpan-364913b4093 )