Tk Library Source Code

View Ticket
Login
Ticket UUID: 1043107
Title: MainFrame: Accelerator Ctrl f does not work
Type: Bug Version: None
Submitter: pointsman Created on: 2004-10-08 14:44:38
Subsystem: bwidget Assigned To: pointsman
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2004-10-09 07:20:07
Resolution: Fixed Closed By: pointsman
    Closed on: 2004-10-09 00:20:07
Description:
A Ctrl f accelerator in a MainFrame menu definition
does not work.

Example script:

package require BWidget

set menuDef {
    "Datei" {} {} 0 {
        {command "E Entry" {} "" {Ctrl e} \
             -command  {puts "E Entry called"}}
        {command "F Entry" {} "" {Ctrl f} \
             -command  {puts "F Entry called"}}
        {command "G Entry" {} "" {Ctrl g} \
             -command  {puts "G Entry called"}}
    }
}

MainFrame .mf -menu $menuDef

Control-e and Control-g fire, Control-f does not.

The reason is in MainFrame::_parse_accelerator. The
regexp {f[1]?[0-9]*} tries to select f1 etc, to
capitalize the f, but unfortunately the regexp also
match a single 'f'. This ends in the Binding
 <Control-Key-F> instead of the necessary <Control-Key-f>.
User Comments: pointsman added on 2004-10-09 06:29:03:
Logged In: YES 
user_id=13222

{^f([1-9]|([12][0-9]|3[0-5]))$} would be a better regexp.
Doesn't match a single f anymore (and therefor fixing the
bug), but all Fxy keys, accepted by tcl8.4 bind (F1 - F35), 

(Though, this automatic spelling correction feature for
MainFraim -menu definition is a bit obscure.)