[pygtk] ComboBox Behavior - End User Perspective
Steve McClure
sMcClure at racemi.com
Wed Mar 21 21:39:23 WST 2007
On Wed, 2007-03-21 at 17:42 +0800, Kurt Symanzik wrote:
> Preben Randhol wrote:
> > On Wed, 21 Mar 2007 16:05:36 +0800
> > Kurt Symanzik <kurt at kbsymanzik.org> wrote:
> >
> >> I have a ComboBox that has no active rows when the application starts
> >> which is accomplished with the set_active(-1) call in the init()
> >> method. I have found that the user may select any row easy enough,
> >> but it is baffling me how to get the ComboBox to allow the *end user*
> >> to select no active row again. In other words, after making a
> >> selection, I want to enable the user to choose "nothing" again
> >> leaving a blank ComboBox as when the application started. I know
> >> that I could add a button that the user could press that I could use
> >> to set_active(-1) on the ComboBox, but that seems like a hack to me.
> >
> > Why don't you in stead have one row in the combobox which is the empty
> > row? Say Row 1, so the user can choose this. Simple and easy to do.
>
> I agree that that is an easy and clean solution in the simple scenario,
> and maybe in my case too (I'll let you judge). In my code the
> underlying base model supplies the data to a TreeView and this ComboBox.
> There is a TreeModelFilter chained together that allows the ComboBox
> to display unique values of a particular column in the base model. I am
> using the ComboBox to give the user the option of filtering out what
> gets displayed in the TreeView. When the ComboBox is empty, then all
> rows are displayed in the TreeView. When the ComboBox contains a
> selection, then only those rows that match that column in the model are
> displayed in the TreeView. Thus, the need for the user to select
> "nothing" in the ComboBox in order to have the TreeView display all rows
> again.
>
> My main concern at this point is that I am correctly understanding the
> ComboBox and associated widgets. Is the empty row solution the best, or
> am I missing something else, or misunderstanding ComboBox, etc. It just
> surprised me that the user could start with no row selected but never
> get back to that original state. In other words, at one point the
> ComboBox truly does display nothing and have nothing selected even
> without an empty row in the underlying model. I would think that that
> state could be reacquired by the user without having to "taint" the model.
>
> Yet, if there is no other way, I could put an empty row in the
> underlying model and then just hide it from the TreeView with a
> TreeModelFilter (I am already using one anyway). If this is the
> cleanest and best solution, then that will work.
There is no 'unselect a selected option' mechanism. The ComboBox
contains an Entry widget where the selection goes. Make that widget
editable and the user can simply clear out the test. You don't have to
manufacture an entry for the combobox that way. However, I've found that
most users are confounded by the fact they can't unselect everything and
never think to try changing stuff in the Entry directly.
>
> Thanks for your input.
>
> Kurt
>
--
Steve McClure Racemi
email: smcclure at racemi.com 380 Interstate North Pkwy, SE
voice: 404-892-5850 Suite 250
fax: 404-892-7215 Atlanta, GA 30339
http://www.racemi.com
More information about the pygtk
mailing list