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: | Amessyroom |
|---|---|
| Location: | Fayetteville, NC |
| Users: | 54 |
| Nodes: | 6 (1 / 5) |
| Uptime: | 21:04:27 |
| Calls: | 742 |
| Files: | 1,218 |
| D/L today: |
6 files (8,794K bytes) |
| Messages: | 185,840 |
| Posted today: | 1 |