Tk-FullKeypad

 view release on metacpan or  search on metacpan

FullKeypad.pm  view on Meta::CPAN

    $this->_putrow(1, $row++, $span, qw*   A  S  D  F  G  H  J  K  L :; "'             *);
    $this->_putrow(1, $row++, $span, qw*   Z  X  C  V  B  N  M*, '<,', qw* >. ?/       *);

    # Specialty keys
    my $kpback = $this->Button(
        -text    => "Backspace\n\x{21d0}",
        -command => sub {$this->_backspace}
        )->grid(
        -row        => 0,
        -column     => 52 + 0,
        -columnspan => $span,
        -sticky     => 'nsew'
        );
    $this->Advertise("KPBack" => $kpback);
    my $kpenter = $this->Button(
        -text    => "Enter\n\x{21b5}",
        -command => sub {$this->_padpress("\n")}
        )->grid(
        -row        => 2,
        -column     => 48 + 2,
        -columnspan => 2 * $span,
        -sticky     => 'nsew'
        );
    $this->Advertise("KPEnter" => $kpenter);
    my $kpspace = $this->Button(
        -text    => "Space",
        -command => sub {$this->_padpress(q{ });}
        )->grid(
        -row        => 3,
        -column     => 44 + 3,
        -columnspan => 1.5 * $span,
        -sticky     => 'nsew'
        );
    $this->Advertise("KP " => $kpspace);
    $this->Advertise("KPSpace" => $kpspace);
    my $kpshift
        = $this->Button(-text => "Shift", -command => sub {$this->_shift})
        ->grid(
        -row        => 3,
        -column     => 50 + 3,
        -columnspan => 1.5 * $span,
        -sticky     => 'nsew'
        );
    $this->Advertise("KPShift" => $kpshift);

    # More specialty keys
    $this->Label(-text=> q{ })->grid(-row => 0, -column => 59); # make a gap

    my $kpcaps = $this->Button(
        -text    => "Caps\nLock",
        -command => sub {$this->_caps}
        )->grid(
        -row        => 2,
        -column     => 0,
        -columnspan => 1.5*$span,
        -sticky     => 'nsew'
        );
    $this->Advertise("KPCaps" => $kpcaps);
    my $kpdel = $this->Button(
        -text    => "Delete",
        -command => sub {$this->_delete}
        )->grid(
        -row        => 0,
        -column     => 60,
        -columnspan => $span,
        -sticky     => 'nsew'
        );
    $this->Advertise("KPDel" => $kpdel);
    my $kpleft = $this->Button(
        -text    => "\x{2190}",
        -command => sub {$this->_arrow(-1)}
        )->grid(
        -row        => 1,
        -column     => 60,
        -columnspan => $span,
        -sticky     => 'nsew'
        );
    $this->Advertise("KPLeft" => $kpleft);
    my $kpright = $this->Button(
        -text    => "\x{2192}",
        -command => sub {$this->_arrow(1)}
        )->grid(
        -row        => 2,
        -column     => 60,
        -columnspan => $span,
        -sticky     => 'nsew'
        );
    $this->Advertise("KPRight" => $kpright);
    my $kpclr = $this->Button(
        -text    => "Clear",
        -command => sub {$this->_clear}
        )->grid(
        -row        => 3,
        -column     => 60,
        -columnspan => $span,
        -sticky     => 'nsew'
        );
    $this->Advertise("KPClear" => $kpclr);

    $this->ConfigSpecs(
        -entry    => ['PASSIVE'],
        'DEFAULT' => ['DESCENDANTS']
    );
    return $this;
}

FullKeypad.pm  view on Meta::CPAN

        my $txt
            = length($key) > 1
            ? q{ } . substr($key, 0, 1) . " \n " . substr($key, 1, 1) . q{ }
            : " $key ";
        my $btn = $this->Button(
            -text    => $txt,
            -command => sub {$this->_padpress($key);},
            )->grid(
            -row        => $row,
            -column     => $i * $span + $row,
            -columnspan => $span,
            -sticky     => 'nsew'
            );
        $this->Advertise("KP$key" => $btn);
        ++$i;
    }
}

sub _shift {
    my $this = shift;
    $this->{_shift} = !$this->{_shift};



( run in 0.332 second using v1.01-cache-2.11-cpan-a5abf4f5562 )