Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Tk DialogBox Enter key behavior

by tallwithblueeyes (Novice)
on Jun 17, 2010 at 22:39 UTC ( [id://845289]=perlquestion: print w/replies, xml ) Need Help??

tallwithblueeyes has asked for the wisdom of the Perl Monks concerning the following question:

I have a Tk DialogBox that contains a Text box subwidget in its top frame. There are "OK' and 'cancel' buttons in the bottom frame. I want to be able to allow the user to press <Enter> when the focus is in the Textbox and add a new line of text. Instead what is happening is that the <Enter> key is causing the DialogBox button binding to be invoked, and it behaves as if i was pressing the OK button. Any way to get my textbox behavior back in this circumstance?

Replies are listed 'Best First'.
Re: Tk DialogBox Enter key behavior
by lamprecht (Friar) on Jun 17, 2010 at 23:07 UTC
    Hi,

    remove the Dialogs <Return> binding:

    use strict; use warnings; use Tk; my $mw = tkinit; my $d = $mw->DialogBox(); $d->add('Text')->pack; $d->bind('<Return>',''); $d->Show;

    Cheers, Christoph

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://845289]
Approved by planetscape
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (3)
As of 2024-04-24 20:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found