Changes to combobox.tcl and related files: ### version 2.3: * added -buttonbackground options * added -listvar option * tweaked packing order of internal widgets, which improves the resize behavior a bit (thanks to Oliver Bienert for the suggestion) * exposed "subwidget" command (eg: .combobox subwidget entry) * made code which is called when the widget is destroyed a bit more robust; someone reported that their wish process would sometimes crash while trying to destroy a combobox widget and this fix made that crash ### version 2.2.2: * fixed bug where dropdown list would appear behind the main window on some window managers. ### version 2.2.1: * fixed case where mousewheel binding caused problems with tk 8.0 * fixed bug when pressing return with dropdown list visible but nothing is selected ### version 2.2: * added support for tk 8.4 (changed use of tk private commands) * new option -dropdownwidth to control the width of the dropdown menu * new options -disabledforeground, -disabledbackground * added support for using the mousewheel in the dropdown list * finally added documentation for the selection subcommand. For four years now I've been saying "to be added later". It's later. ### version 2.1: * added -opencommand * included documentation for the open and close commands * fixed problem for tk 8.2 where the dropdown list was always behind the parent window. ### version 2.0: * fixed bug when attempting to get the value of the option -value before a value has been set. ### version 2.0b2: * fixed bug with non-editable comboboxes. Sometimes (or was it all the time?), if you selected a value from the dropdown list of a non-editable combobox the value wasn't being set properly. ### version 2.0b1: * option shorthand is now supported (eg: -val instead of -value) * option synonyms are now supported (eg: -bd instead of -borderwidth) * added the commands select and curselection * added option database support * handling of -textvariable is much more straight-forward. Instead of lots of internal wrangling, I merely assign the variable to the -textvariable attribute of the entry widget * lots of comments, and a wee bit more conformance to Scriptics' style guidelines ### version 1.07: * any pre-existing grab is now restored when the dropdown listbox is closed. * it should now be possible to set your own bindings on the combobox widget and have it work the way you expect. However, the default bindtags for the widget probably *aren't* what you expect. * keyboard traversal / focus management is much better now. Shift-tab seems to do the right thing without resorting to any hackery. * fixed bug where the down arrow wouldn't cause the a dropdown list to display. * added support for -highlightcolor * added the "subwidget" command, to allow you to get at some of the internal widget paths. I would prefer not to have to expose the underpinnings of this widget, but I think some advanced users may need this. * modified the example to show how one can add a list of items at once, and to include -highlightthickness * added support for -xscrollcommand, and added a test case in test.tcl for this option * man page has been changed to more accurately describe when the -command is called. These rules have changed slightly from previous versions. * modified how and where the dropdown lists pops up. In theory it should handle virtual desktops better. Also, for obscenely large lists (ie: bigger than will fit on the screen) we try to fit it the best we can. It will either pop up above or below the entry widget depending on which side gives us the largest list, and will be trimmed to start or stop at the edges of the screen. * added the list command to the man page Thanks to John Jackson and Todd Helfter of the Purdue University Computer Center for the patch to handle virtual window managers ### version 1.06: * dropdown list scrollbar is now "smart", and will only appear if the number of elements in the list is larger than the -height (or -maxheight, if -height is zero) of the widget * slightly different bitmap for the button, courtesy of Martin M. Hunt * slight modification to the computation of the height of the dropdown list. The computation now takes into consideration the borderwidth of the dropdown list * added option -commandstate. If "disabled", the value of -command will *not* be called when the value changes. Useful for setting the value programatically when you don't want to run the associated command. NB: I really like this concept (of a -commandstate); I sure wish all tk widgets had such an option... * added value checks when setting -state and -commandstate (prior to 1.06 we would attempt to set the state to whatever you passed in) * fixed bug in error reporting of some listbox manipulation commands (like ".foo list insert" and friends) * the -command is called whenever something is chosen from the list or the user presses return with focus in the entry, even if the value hasn't changed. The reasoning is that some people might actually want this behavior, and for those that don't they can easily do the check for a changed value themselves. * went back to putting all procs _outside_ the initial namespace eval, as per suggestions in the style guide published by scriptics. * focus is better handled when the dropdown listbox is hidden -- focus should now be restored to whatever widget had it last. * added a keyboard widget traversal hack in the README.txt file; this hack also appears in test.tcl ### version 1.05: * removed a bunch of the "namespace eval" nonsense, in favor of a more straight-forward technique using upvar. I still use namespaces, but I think the implementation is a bit more sensible now. * put braces around a few expressions that didn't have them. * put all procs within a single "namespace eval" command, rather than defining them at the global level, with the namespace used as part of the proc name. A net effect of zero, but this method just feels more "right". ### version 1.04: Thanks for Martin M. Hunt (hunt@cygnus.com) for some of these fixes, or the inspiration thereof * fixed bug when calling the -command proc when the value that was selected contained spaces * selecting an item from the listbox when -editable is false no longer sets the selection in the entry widget * fixed bug where the entry widget of a non-editable combobox would become enabled under certain circumstances * added a bit of code to set the button width to mimic the width of a standard scrollbar * added -height option, to set the height of the listbox * added -maxheight option, to support the combobox autosizing up to some maximum size * poping up a list when the list would go past the bottom of the screen will cause the list to pop above the entry widget instead of below * fixed bug in cget routine ### version 1.03: * scanning the list works. You can click on the button (but not release) and drag over the list. If you drag above or below the list it should scroll appropriately * if you have a textvariable defined, it is no longer set to "" initially * tab completion has changed slightly..if you type in something that doesn't match it will try to find something that does (for example, typing "apx" when "append" is a valid value will highlight append). * changed the "insert" and "delete" commands to "listinsert" and "listdelete" * added the commands "listindex", "listget", "listsize", which are passed to the listbox as index, get and size, respectively. This gives you what I think is sufficient access to the listbox (but see more about this below...) * added the commands "bbox", "insert", "delete", "icursor", "scan", "xview", and "selection", which are passed directly to the entry widget. I haven't tested them all much, but in theory if one works they all should work... (or conversely, if one is broken...) * in the entry closes the list if it is open * added configuration option -selectcommand. It is a command that gets executed whenever something from the dropdown list is selected. It *doesn't* get called if you just type in the box. I wasn't sure when to call it in the latter case -- after each keypress? After a ? When focus changes? So for the time being it is only called when you select from the list, and it will append to the command the name of the widget and the index of the item selected. This works very well for -editable false. If you want a command to trigger for -editable true, just put a trace on a -textvariable. ### version 1.02: * the namespace for the widget has moved below the ::Combobox namespace * interaction of pageup/pagedown and up/down has been fixed * new method for mapping window * fixed double-click behavior when widget is disabled * fixed case where you could pop up the list even if the widget was disabled * tweaked testing routine to use rgb values instead of color names * clicking Button 1 in the entry widget will pop up the list if the widget is enabled but not editable * clicking Button 1 anywhere in the app when the list is showing will close the list * closing the listbox will cause the data in the entry widget to be selected * added options -selectbackground, selectforeground and -selectborderwidth * added option -cursor * added check for unknown option in configure, cget * added package require Tk 8.0 * changed behavior of tab key in the entry widget; it still trys to match what is there with something in the list, but the way it chooses to display the data in the entry widget has changed slightly.