Check the -indicatoron option for TCL *radiobuttons*.
Command-Line Name:-indicatoron
Database Name: indicatorOn
Database Class: IndicatorOn
Specifies whether or not the indicator should be drawn. Must be
a proper boolean value. If false, the -relief option is ignored
and the widget's relief is always sunken if the widget is se-
lected and raised otherwise.
Hello out there,
for a kinf´d of technical app I need a 'switch type' button - that is
a button stays pressed when pressed once and only gets released when
pressed again. (Whereas the normal GUI behaviour of buttons is more
the 'door bell' type).
I did come as far as keeping it pressed using the code below:
---
package require Tk
foreach ch [winfo children "."] {destroy $ch}
proc btnPress {w var} {
if {[set $var]} {
puts "calling 'tk::ButtonUp $w'"
tk::ButtonUp $w
set $var 0
} else {
puts "calling 'tk::ButtonDown $w'"
tk::ButtonDown $w
set $var 1
}
}
proc tst {} {
set btn [button .btn -width 3 -text ""]
pack $btn
set ::${btn}State 0
bind $btn <Button-1> [list btnPress %W ::${btn}State]
bind $btn <Enter> {break}
bind $btn <Leave> {break}
bind $btn <<Invoke>> {break}
bind $btn <Key-space> {break}
bind $btn <ButtonRelease-1> {break}
return $btn
}
set b [tst]
---
All the 'break' statements are for disabling the class bindings for
'Button'.
What I see is
- on the first press the ButtonDown message appears and the button
gets pressed
- on following presses I see the Up/Down messages appear as they
should - but my button never gets released again.
This is on Windows 10 and Tcl 8.6.10.
Any help will be greatly appreciated
Helmut
On 4/17/2024 7:21 AM, Helmut Giese wrote:
Hello out there,
for a kinf´d of technical app I need a 'switch type' button - that is
a button stays pressed when pressed once and only gets released when
pressed again. (Whereas the normal GUI behaviour of buttons is more
the 'door bell' type).
| Sysop: | Keyop |
|---|---|
| Location: | Huddersfield, West Yorkshire, UK |
| Users: | 715 |
| Nodes: | 16 (2 / 14) |
| Uptime: | 149:54:07 |
| Calls: | 12,091 |
| Calls today: | 4 |
| Files: | 15,000 |
| Messages: | 6,517,584 |