You could also try with FocusIn and FocusOut, or some combination of the two types.

Not needed, see Tk::bind#DESCRIPTION/Tk::bindtags or  perl -MTk -le " print tkinit->Entry->bindDump "

## Binding information for '.entry', Tk::Entry=HASH(0xf42164) ## 1. Binding tag 'Tk::Entry' has these bindings: <B2-Motion> : Tk::Callback=SCALAR(0xf41ea4) + 'B2_Motion' <Button-2> : Tk::Callback=SCALAR(0xf41eb4) + 'Button_2' <Meta-Key-Delete> : Tk::Callback=ARRAY(0xf41df4) + 'delete' Tk::Ev=ARRAY(0xf41d74) + : 'wordstart' 'insert' <Meta-Key-BackSpace> : Tk::Callback=ARRAY(0xf41da4) + 'delete' Tk::Ev=ARRAY(0xf41d14) + : 'wordstart' 'insert' <Meta-Key-f> : Tk::Callback=ARRAY(0xf41d24) + 'SetCursor' Tk::Ev=ARRAY(0xf41c74) + : 'wordend' <Meta-Key-d> : Tk::Callback=ARRAY(0xf41cd4) + 'delete' 'insert' Tk::Ev=ARRAY(0xf41c24) + : 'wordend' <Meta-Key-b> : Tk::Callback=ARRAY(0xf41c54) + 'SetCursor' Tk::Ev=ARRAY(0xf41be4) + : 'wordstart' <Control-Key-t> : Tk::Callback=SCALAR(0xf41c94) + 'Transpose' <Control-Key-k> : Tk::Callback=ARRAY(0xf41b34) + 'delete' 'insert' 'end' <Control-Key-h> : Tk::Callback=SCALAR(0xf41c14) + 'Backspace' <Control-Key-f> : Tk::Callback=ARRAY(0xf41b74) + 'SetCursor' Tk::Ev=ARRAY(0xf41b14) + : 'deltainsert' '1' <Control-Key-e> : Tk::Callback=ARRAY(0xf41ae4) + 'SetCursor' 'end' <Control-Key-d> : Tk::Callback=ARRAY(0xf41a84) + 'delete' 'insert' <Control-Key-b> : Tk::Callback=ARRAY(0xf41a64) + 'SetCursor' Tk::Ev=ARRAY(0xf3f6fc) + : 'deltainsert' '-1' <Control-Key-a> : Tk::Callback=ARRAY(0xf3f68c) + 'SetCursor' '0' <Key-Tab> : Tk::Callback=SCALAR(0xf41a44) + 'NoOp' <Key-KP_Enter> : Tk::Callback=SCALAR(0xf41a24) + 'NoOp' <Key-Return> : Tk::Callback=SCALAR(0xf41a04) + 'NoOp' <Control-Key> : Tk::Callback=SCALAR(0xf3f78c) + 'NoOp' <Meta-Key> : Tk::Callback=SCALAR(0xf3f76c) + 'NoOp' <Alt-Key> : Tk::Callback=SCALAR(0xf3f77c) + 'NoOp' <Key> : Tk::Callback=ARRAY(0xf3f6ac) + 'Insert' Tk::Ev=SCALAR(0xf3f01c) + : 'A' <Control-Key-backslash> : Tk::Callback=SCALAR(0xf3f71c) + 'selectionClear' <Control-Key-slash> : Tk::Callback=ARRAY(0xf3f62c) + 'selectionRange' '0' 'end' <Shift-Key-Select> : Tk::Callback=ARRAY(0xf3f5ec) + 'selectionAdjust' 'insert' <Control-Shift-Key-space> : Tk::Callback=ARRAY(0xf3f5cc) + 'selectionAdjust' 'insert' <Key-Select> : Tk::Callback=ARRAY(0xf3f52c) + 'selectionFrom' 'insert' <Control-Key-space> : Tk::Callback=ARRAY(0xf3f4ec) + 'selectionFrom' 'insert' <Key-BackSpace> : Tk::Callback=SCALAR(0xf3f56c) + 'Backspace' <Key-Delete> : Tk::Callback=SCALAR(0xf3f58c) + 'Delete' <Shift-Key-End> : Tk::Callback=ARRAY(0xf3f4ac) + 'KeySelect' 'end' <Key-End> : Tk::Callback=ARRAY(0xf3f46c) + 'SetCursor' 'end' <Shift-Key-Home> : Tk::Callback=ARRAY(0xf3f42c) + 'KeySelect' '0' <Key-Home> : Tk::Callback=ARRAY(0xf3f3bc) + 'SetCursor' '0' <Control-Shift-Key-Right> : Tk::Callback=ARRAY(0xf3f3ec) + 'KeySelect' Tk::Ev=ARRAY(0xf3f35c) + : 'wordend' <Control-Shift-Key-Left> : Tk::Callback=ARRAY(0xf3f38c) + 'KeySelect' Tk::Ev=ARRAY(0xf3f2fc) + : 'wordstart' <Control-Key-Right> : Tk::Callback=ARRAY(0xf3f30c) + 'SetCursor' Tk::Ev=ARRAY(0xf3f2ac) + : 'wordend' <Control-Key-Left> : Tk::Callback=ARRAY(0xf3f2cc) + 'SetCursor' Tk::Ev=ARRAY(0xf3f22c) + : 'wordstart' <Shift-Key-Right> : Tk::Callback=ARRAY(0xf3f25c) + 'KeySelect' Tk::Ev=ARRAY(0xf3f1bc) + : 'deltainsert' '1' <Shift-Key-Left> : Tk::Callback=ARRAY(0xf3f1ec) + 'KeySelect' Tk::Ev=ARRAY(0xf3f16c) + : 'deltainsert' '-1' <Key-Right> : Tk::Callback=ARRAY(0xf3f17c) + 'SetCursor' Tk::Ev=ARRAY(0xf3f07c) + : 'deltainsert' '1' <Key-Left> : Tk::Callback=ARRAY(0xf3f0cc) + 'SetCursor' Tk::Ev=ARRAY(0xf4c51c) + : 'deltainsert' '-1' <Control-Button-1> : Tk::Callback=SCALAR(0xf3f0ec) + 'Control_1' <B1-Enter> : Tk::Callback=SCALAR(0xf3f0fc) + 'CancelRepeat' <B1-Leave> : Tk::Callback=ARRAY(0xf3f02c) + 'AutoScan' Tk::Ev=SCALAR(0xf3efbc) + : 'x' <Shift-Button-1> : Tk::Callback=SCALAR(0xf3f08c) + 'Shift_1' <Triple-Shift-Button-1> : Tk::Callback=ARRAY(0xf3efdc) + 'MouseSelect' Tk::Ev=SCALAR(0xf3ef4c) + : 'x' 'line' <Triple-Button-1> : Tk::Callback=ARRAY(0xf3ef5c) + 'MouseSelect' Tk::Ev=SCALAR(0xf3eeec) + : 'x' 'line' '0' <Double-Shift-Button-1> : Tk::Callback=ARRAY(0xf3eefc) + 'MouseSelect' Tk::Ev=SCALAR(0xf3ee1c) + : 'x' 'word' <Double-Button-1> : Tk::Callback=ARRAY(0xf3ee8c) + 'MouseSelect' Tk::Ev=SCALAR(0xf3ee3c) + : 'x' 'word' 'sel.first' <B1-Motion> : Tk::Callback=ARRAY(0xf3ee2c) + 'Motion' Tk::Ev=SCALAR(0xf3edcc) + : 'x' Tk::Ev=SCALAR(0xf3ed9c) + : 'y' <ButtonRelease-1> : Tk::Callback=ARRAY(0xf3eddc) + 'Button1Release' Tk::Ev=SCALAR(0xf3ed4c) + : 'x' Tk::Ev=SCALAR(0xf3ecfc) + : 'y' <Button-1> : Tk::Callback=ARRAY(0xf3ed0c) + 'Button1' Tk::Ev=SCALAR(0xf3ec5c) + : 'x' Tk::Ev=SCALAR(0xf3ec4c) + : 'y' <Key-Escape> : Tk::Callback=SCALAR(0xf3ed7c) + 'selectionClear' <<PasteSelection>> : Tk::Callback=ARRAY(0xf3ec6c) + CODE(0xf4f614) Tk::Ev=SCALAR(0xf1d234) + : 'x' <<Clear>> : Tk::Callback=ARRAY(0xf3ed2c) + CODE(0xf4f514) <<Paste>> : Tk::Callback=SCALAR(0xf3eccc) + 'clipboardPaste' <<Cut>> : Tk::Callback=SCALAR(0xf3ecac) + 'clipboardCut' <<Copy>> : Tk::Callback=SCALAR(0xf3ec8c) + 'clipboardCopy' 2. Binding tag '.entry' has no bindings. 3. Binding tag '.' has no bindings. 4. Binding tag 'all' has these bindings: <<LeftTab>> : Tk::Callback=SCALAR(0xf1d254) + 'focusPrev' <Key-Tab> : Tk::Callback=SCALAR(0xf1d1d4) + 'focusNext' <KeyRelease-F10> : + <Key-F10> : + <Alt-KeyRelease> : + <Alt-Key> : + <KeyRelease-Alt_R> : + <Key-Alt_R> : + <KeyRelease-Alt_L> : + <Key-Alt_L> :

Dont bind to keypress when you're wanting to bind to key, don't override "class" bindings when you're wanting to override an instance binding .. bindtags order and break


In reply to Re^2: Tk preventing a char in Entry widged to trigger a KeyBinding by Anonymous Monk
in thread Tk preventing a char in Entry widged to trigger a KeyBinding by Discipulus

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.