Tk-HexEntry

 view release on metacpan or  search on metacpan

HexEntryPlain.pm  view on Meta::CPAN

package Tk::HexEntryPlain;

use Tk ();
use Tk::Derived;
use Tk::Entry;
use strict;

use vars qw(@ISA $VERSION);
@ISA = qw(Tk::Derived Tk::Entry);
$VERSION = sprintf("%d.%02d", q$Revision: 0.01 $ =~ /(\d+)\.(\d+)/);

Construct Tk::Widget 'HexEntryPlain';

sub ClassInit {
    my ($class,$mw) = @_;

    $class->SUPER::ClassInit($mw);

    $mw->bind($class,'<Leave>', 'Leave');
    $mw->bind($class,'<FocusOut>', 'Leave');
    $mw->bind($class,'<Return>', 'Return');
    $mw->bind($class,'<Up>', 'Up');
    $mw->bind($class,'<Down>', 'Down');
    $mw->bind($class,'<Home>', 'Home');
    $mw->bind($class,'<End>', 'End');
    $mw->bind($class,'<Prior>', 'Prior');
    $mw->bind($class,'<Next>', 'Next');
}


## Bindings callbacks

 sub Leave {
    my $e = shift;
    $e->incdec(0);  # range check
}

sub Return {
    my $e = shift;

    my $v = $e->value; # range check

    $e->Callback(-command => $v);
}

sub Up {
    my $e = shift;
    $e->incdec($e->cget(-increment));
}

sub Down {
    my $e = shift;
    $e->incdec(-$e->cget(-increment));
}

sub Prior {
    my $e = shift;
    $e->incdec($e->cget(-bigincrement) || 1);
}

sub Next {
    my $e = shift;
    $e->incdec(-($e->cget(-bigincrement) || 1));
}

sub Insert {
    my($e,$c) = @_;

    my $dot = ($e->cget(-increment) =~ /\./ ? '.' : '');



( run in 1.172 second using v1.01-cache-2.11-cpan-a1f116cd669 )