Menu

#73 Provide a 'None' modifier for event bindings

open
5
2003-11-13
2000-11-01
No

OriginalBugID: 4437 RFE
Version: 8.3
SubmitDate: '2000-03-21'
LastModified: '2000-04-07'
Severity: MED
Status: UnAssn
Submitter: techsupp
ChangedBy: hobbs
OS: All

Name:
Jay Schmidgall

Comments:
Note that this functionality is backwards compatible. Only if the None
or ! modifiers are specified does the new behavior occur.

DesiredBehavior:
Currently there is no simple way to create a binding on a widget which fires when a key is pressed with no modifiers, but which does not fire if that same key is pressed with a binding. For example,

bind .button <Key-f> { puts fires }

will fire when the f key is pressed, but will also fire when Control-f is pressed. One needs to write more code to weed out the cases when a modifier is present.

If a 'None' modifier was provided, one could specify

bind .button <None-Key-f> { puts fires }

and pressing Control-f would not fire.

A further consideration would be to provide exact match functionality. For example, if one specifies

bind .button <!Control-Key-f> { puts fires }

then the bind would fire only when only Control-f was pressed. If any other modifier was present, or a pointer button was depressed at the same time, the binding would not fire.

In this case, the None modifier is the same as ! with no modifiers specified. That is,

bind .button <None-Key-f> { puts fires }

is equivalent to

bind .button <!Key-f> { puts fires }

Note this functionality is already present in the X translation table syntax. It would be nice if Tk could be extended to provide analogous behavior.

Discussion

  • Jeffrey Hobbs

    Jeffrey Hobbs - 2001-06-19
    • labels: 104336 -->
    • milestone: 102505 -->
     
  • Donal K. Fellows

    Logged In: YES
    user_id=79902

    I'm not quite sure this is as good an idea as it seems. The
    problem is that there are a lot more modifiers than there
    appear to be; requiring that someone turns off CapsLock and
    (more particularly) NumLock just to activate a binding is
    not a good idea, as experience prior to Tk4 showed.

     
  • Donal K. Fellows

    • labels: --> 01. Bindings
     
  • Don Porter

    Don Porter - 2003-11-13
    • assigned_to: nobody --> dkf
     
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.