I want Ctrl+A to select all in a ttk::combobox's entry.
But I can't get it to work. Here's an example
(I'm using Tcl/Tk 9.0.2 on Linux):
#!/usr/bin/env wish9
proc on_select_all widget {
puts "on_select_all $widget"
$widget selection range 0 end
}
tk scaling 2
wm title . ComboTest
ttk::combobox .combo -values {One Two Three}
.combo set Three
pack .combo -fill x -expand true
bind .combo <Control-a> {on_select_all %W}
bind . <Escape> exit
wm protocol . WM_DELETE_WINDOW exit
focus .combo
When I press Ctrl+A it correctly prints the widget,
but it doesn't do the select. What am I doing wrong?
I want Ctrl+A to select all in a ttk::combobox's entry.
But I can't get it to work. Here's an example
(I'm using Tcl/Tk 9.0.2 on Linux):
#!/usr/bin/env wish9
proc on_select_all widget {
puts "on_select_all $widget"
$widget selection range 0 end
}
tk scaling 2
wm title . ComboTest
ttk::combobox .combo -values {One Two Three}
.combo set Three
pack .combo -fill x -expand true
bind .combo <Control-a> {on_select_all %W}
bind . <Escape> exit
wm protocol . WM_DELETE_WINDOW exit
focus .combo
When I press Ctrl+A it correctly prints the widget,
but it doesn't do the select. What am I doing wrong?
Am 15.11.25 um 08:52 schrieb Mark Summerfield:
I want Ctrl+A to select all in a ttk::combobox's entry.
But I can't get it to work. Here's an example
(I'm using Tcl/Tk 9.0.2 on Linux):
#!/usr/bin/env wish9
proc on_select_all widget {
puts "on_select_all $widget"
$widget selection range 0 end
}
tk scaling 2
wm title . ComboTest
ttk::combobox .combo -values {One Two Three}
.combo set Three
pack .combo -fill x -expand true
bind .combo <Control-a> {on_select_all %W}
bind . <Escape> exit
wm protocol . WM_DELETE_WINDOW exit
focus .combo
When I press Ctrl+A it correctly prints the widget,
but it doesn't do the select. What am I doing wrong?
Append
return -code break
as last line to the body of the on_select_all proc. For the explanation search for "Control-a" in the ttk_entry manual page.
| Sysop: | DaiTengu |
|---|---|
| Location: | Appleton, WI |
| Users: | 1,089 |
| Nodes: | 10 (0 / 10) |
| Uptime: | 153:53:54 |
| Calls: | 13,921 |
| Calls today: | 2 |
| Files: | 187,021 |
| D/L today: |
3,760 files (944M bytes) |
| Messages: | 2,457,163 |