Re: Alternative to gtk_widget_set_sensitive on GetComboBoxEntry



On Thu, Mar 14, 2013 at 4:05 PM, Ian Puleston
<ian underpressuredivers com> wrote:
I'd forgotten about that, and yes, used in combination with the previous
suggestion it achieves the desired effect. In fact, either of these work:


gtk_editable_set_editable(GTK_EDITABLE(gtk_bin_get_child(GTK_BIN(combo))),
FALSE);
    gtk_combo_box_set_button_sensitivity(GTK_COMBO_BOX(combo),
GTK_SENSITIVITY_OFF);

or:
    gtk_widget_set_sensitive(gtk_bin_get_child(GTK_BIN(combo)), FALSE);
    gtk_combo_box_set_button_sensitivity(GTK_COMBO_BOX(combo),
GTK_SENSITIVITY_OFF);

Both show the text in the disabled combo entry, the latter grays it out, the
former doesn't.

We got there. Thanks
Ian

Now that you've found a work-around to setting the combo-box insensitive,
could you please also ensure that there is a bug filed for GtkComboBox ?

As far as I know, widgets in GTK+ are supposed to maintain their state
when insensitive (for instance, an insensitive GtkSwitch, GtkLabel,
GtkEntry, GtkToggleButton, GtkRadioButton... all can be set insensitive
without losing the current state).

I don't see why it would be acceptable that the GtkComboBox behave
differently than other widgets regarding sensitivity, and not filing a bug
about it is an open invitation for the bug to remain unfixed.

Thanks,
       -Tristan


-----Original Message-----
From: salsaman [mailto:salsaman gmail com]
Sent: Wednesday, March 13, 2013 4:42 AM
To: Ian Puleston
Cc: gtk-list gnome org
Subject: Re: Alternative to gtk_widget_set_sensitive on GetComboBoxEntry

Hmmm...how about:

gtk_combo_box_set_button_sensitivity(GTK_COMBO_BOX(entry),
GTK_SENSITIVITY_OFF);


Salsaman.


http://lives.sourceforge.net
https://www.ohloh.net/accounts/salsaman


On Wed, Mar 13, 2013 at 3:43 AM, Ian Puleston
<ian underpressuredivers com> wrote:
Thanks, for the suggestion, but nope. Your suggestion gives a
"gtk_editable_set_editable: assertion `GTK_IS_EDITABLE (editable)'
failed"
assertion failure. The following works to make the entry field
non-editable:

gtk_editable_set_editable(GTK_EDITABLE(gtk_bin_get_child(GTK_BIN(entry
))),
FALSE);

However, what that achieves is just to make the entry field
non-editable.
The drop-down selection part still operates.

Ian

-----Original Message-----
From: salsaman [mailto:salsaman gmail com]
Sent: Tuesday, March 12, 2013 3:19 PM
To: Ian Puleston
Cc: gtk-list gnome org
Subject: Re: Alternative to gtk_widget_set_sensitive on
GetComboBoxEntry

Try:

gtk_editable_set_editable(GTK_EDITABLE(entry), FALSE);


Regards,
Salsaman.

http://lives.sourceforge.net
https://www.ohloh.net/accounts/salsaman


On Tue, Mar 12, 2013 at 4:52 PM, Ian Puleston
<ian underpressuredivers com> wrote:
Hi,



I have a dialog with a GetComboBoxEntry and under certain
circumstances I need to make it non-user-editable, but still want
it to display the selected entry. I'm using
gtk_widget_set_sensitive to disable it, but a side effect of that
is that when set insensitive it displays blank and does not show the
selected entry.



I can't say 100% for sure but I think that this used to work with
earlier versions of GTK? I say that because my code gets the
selected entry via a gtk_combo_box_get_active_text call on it, and
that is now failing (returning an empty string) and throwing an
error when the combo is insensitive, and I'm pretty sure that it
never used to get that
error.



The latter problem I've worked around, but I would still like the
control to show the user which entry is selected when it is not
enabled (just like a disabled JavaScript select element does). So
is there a way to make it do that?



This is with the latest GTK 2.



Thanks,

Ian


_______________________________________________
gtk-list mailing list
gtk-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-list



_______________________________________________
gtk-list mailing list
gtk-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-list


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