Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bind BWidget::ComboBox to select event

238 views
Skip to first unread message

Victor S.

unread,
Jun 13, 2007, 5:03:01 PM6/13/07
to
I am trying to catch some sort of select even when a different value
of a read-only (-editable false) BWidget::ComboBox is selected, but I
don't see any event that I can use for this. ttk::combobox, for
example, generates a virtual event <<ComboboxSelected>>, but I don't
see anything equivalent in the BWidget version. Am I missing
something?

Here's a small script that I use to test:

package require Tk
package require BWidget
frame .fm
ComboBox .fm.c -values "apple pear orange" -editable false
#
# Of course the bind below doesn't work because there is no
<<LisboxSelect>>
# event being generated by the ComboBox
#
bind .fm.c <<ListboxSelect>> { tk_messageBox -message "Select!" }
pack .fm.c
pack .fm

When using Tile, this is simple:
ttk::combobox .fm.c -values "apple pear orange" -state readonly
bind .fm.c <<ComboboxSelected>> { tk_messageBox -message
"Select!" }

Is there a way to get BMWidget::ComboBox to throw an event on
selection change?

Thanks in advance,
Victor

Damon Courtney

unread,
Jun 13, 2007, 6:29:11 PM6/13/07
to


Take a look at the -modifycmd option of the widget. This specifies a
command to call anytime a new option is selected in the drop down
window.

Damon

Victor S.

unread,
Jun 13, 2007, 9:47:38 PM6/13/07
to

Damon,

Of course! Thank you, that did the trick! I guess I was so focused on
looking for a binding that I missed an option.

VIctor

0 new messages