I have a BWidget ComboBox with a lot of items.
set SomeVar "hello"
set combotext "Take your pick"
$::c1.outerframe.frame4.combo configure -text "Take your pick"
I select one item from the ComboBox:
$::c1.outerframe.frame4.combo configure -modifycmd "puts [$::c1.outerframe.frame4.combo get]"
Take your pick
It doesn't matter which item I pick:
Take your pick
Take your pick
Take your pick
Add a new line:
$::c1.outerframe.frame4.combo configure -textvariable SomeVar
I select one item from the ComboBox:
$::c1.outerframe.frame4.combo configure -modifycmd "puts $SomeVar"
hello
It doesn't matter which item I pick:
hello
hello
hello
The manual also says,
"pathName getvalue
Returns the index of the current text of the ComboBox in the list of
values, or -1 if it doesn't match any value."
Well, I cannot choose anything that is not in my values list, but no
matter what I choose, pathName getvalue returns -1.
How do I capture the current selection of a BWidget ComboBox?
The only page I could find with that specific question has been
unanswered for 10 years.
https://stackoverflow.com/questions/17424489/tcl-bwidget-how-can-i-pass-my-combobox-selected-value-to-the-command
3. To solve the problem, you should change the above line to become**************************
$::c1.outerframe.frame4.combo configure -modifycmd { puts
[$::c1.outerframe.frame4.combo get] }
which will work as expected, due to the use of braces instead of
quotation marks. Even better (the recommended way):
$::c1.outerframe.frame4.combo configure -modifycmd [list modifCmd
$::c1.outerframe.frame4.combo]
proc modifCmd w { puts [$w get] }
On Thu, 7 Mar 2024 16:33:13 +0100, nemethi wrote:
3. To solve the problem, you should change the above line to become**************************
$::c1.outerframe.frame4.combo configure -modifycmd { puts
[$::c1.outerframe.frame4.combo get] }
which will work as expected, due to the use of braces instead of
quotation marks. Even better (the recommended way):
$::c1.outerframe.frame4.combo configure -modifycmd [list modifCmd
$::c1.outerframe.frame4.combo]
proc modifCmd w { puts [$w get] }
That works. Thanks.
Would you by any chance know how to control the background color of
a ttk::spinbox? Mine looks gray and strange.
I tried setting it to #FFFFFF but that changes the color of the arrows' background, not the value input box as I expected.
Sysop: | DaiTengu |
---|---|
Location: | Appleton, WI |
Users: | 920 |
Nodes: | 10 (0 / 10) |
Uptime: | 102:07:36 |
Calls: | 12,189 |
Calls today: | 1 |
Files: | 186,527 |
Messages: | 2,237,472 |