Need Keypad to work in Text widgets 
Author Message
 Need Keypad to work in Text widgets

Unlike the X11/Motif program I'm writing in which the keypad
keys work by default in XmText widgets, using Perl/Tk the
same appears not to be true: the keypad keys are ignored.

Anyone know how to fix this?

Thanks.

---                                                          




Tue, 17 Nov 1998 03:00:00 GMT  
 Need Keypad to work in Text widgets


Quote:

>Unlike the X11/Motif program I'm writing in which the keypad
>keys work by default in XmText widgets, using Perl/Tk the
>same appears not to be true: the keypad keys are ignored.

>Anyone know how to fix this?

>Thanks.

>---                                                          



Well lets see on my kepad the keys are named things like:
 qw(<KP_1> <KP_2> ); etc. (period is <KP_Decimal>, comma is <KP_Separator>)
 "PF1" through "PF4" are (<KP_F1> .. <KP_F4>)

Ali Corbin's previously posted script really, really helps with this stuff.
Here is is in all it's glory:

=cut

#!/usr/local/bin/perl -w

use Tk;

$top = MainWindow->new();

$frame = $top->Frame( -height => '6c', -width => '6c',
                        -background => 'black', -cursor => 'gobbler' );
$frame->pack;

$top->bind( '<Any-KeyPress>' => sub
{

    my $e = $c->XEvent;
    my( $x, $y, $W, $K, $A ) = ( $e->x, $e->y, $e->K, $e->W, $e->A );

    print "A key was pressed:\n";
    print "  x = $x\n";
    print "  y = $y\n";
    print "  W = $K\n";
    print "  K = $W\n";
    print "  A = $A\n";

Quote:
} );

MainLoop();

__END__

Hope that helps.

Peter Prymmer



Wed, 18 Nov 1998 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Need Keypad to work in Text widgets

2. Entry widget with number keypad

3. Making keyboard's keypad work with Tk

4. why does grid not work with text widget?

5. Ev not working correctly during a callback on Text widget

6. Need some help with the Text Widget and more

7. Nonmember submission: Need some help with the Text Widget and more

8. Resizing Text Widget, why are both fill and expand needed

9. Can Tk Widget and Xt Widget work together?

10. Q: Changing Text-Color in Text-Widget?

11. text formatting in a Text widget

12. How update text in text widget when executing some other callback

 

 
Powered by phpBB® Forum Software