Re: GtkComboBox can't be reset



Diego Zuccato wrote:
>>> I Noticed an anti-intuitive thing.
>>> Once I've selected a value in a combo box, I can't "reset" it (from an
>>> user's POV). Is there a reason not to handle an "esc" press on it to
>>> call ...set_active(this, -1) ? I know I can do it myself in my programs,
>>> but IMVHO it should be done by the library.
>>
>> Why would you want to "reset" a combo box from the user interface? Even
>> if one ignores the fact that such a change would (possibly) break quite
>> a lot of applications, it doesn't seem to be very useful at all. If an
>> application offers a "reset"-state to the user, it'll usually include a
>> "None"/"Disabled" item in the combobox' model.
> 
> Then Gtk should ENFORCE that by selecting the first row of the model.
> I'm using a model filled from a DB and it's quite useful to have the
> current behaviour PLUS "esc" management. And it's orthogonal (think a
> box that lets you select an user from a list, or "nothing" to broadcast:
> now, once you've selected a user you can't rethink and send to all). IMO
> the current behaviour is the safest (a row in the model gets accessed
> only when the user wants to), and adding "esc" handling shouldn't break
> anything. A complete solution would require API changes
> (gtk_combo_box_set_default_selection() ?) to be done really well, but
> calling gtk_combo_box_set_active(this, -1) should be quite safe.

Then it'd be better to add an item "Broadcast to all users". How many
users of your application would assume that selecting "nothing" means
"broadcast to all users"  anyway?

Automatically selecting the first item of the model once the model is
set sounds like a sane option (esp. since that's what nearly every
application does right now, as an "empty combobox" is more or less
confusing to the casual user).

> BYtE,
>  Diego.

Benedikt



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]