Re: Gtk2::ComboBox - setting value by string?
- From: "John M. Burian" <john burian org>
- To: gtk-perl-list gnome org
- Subject: Re: Gtk2::ComboBox - setting value by string?
- Date: Tue, 08 Aug 2006 22:11:41 -0400
It doesn't fix the 'bug', such as it is, but a technique I use is to, as
I'm adding values to the ListStore, create a hash that maps the strings
back to the indicies of the ListStore, then add a reference to that hash
to the ComboBox object.
$list = Gtk2::ListStore->new ("Glib::String");
map {
$list->set ($iter = $list->append, 0, $_);
$$href{$_} = $list->get_string_from_iter ($iter);
} (qw/Option1 Option2 Option3/);
$combobox = Gtk2::ComboBox->new_with_model ($list);
$combobox->{hash} = $href;
Then later, to set the value of the combobox using the string:
$combobox->set_active ($combobox->{hash}{'Option1'});
Torsten Schoenfeld wrote:
On Tue, 2006-08-08 at 11:29 +1000, Daniel Kasak wrote:
IMHO there are *far* too many combo-related bugs in gtk+ :( Don't the
developers use combos?
Keep in mind that most of the gtk+ developers are working on gtk+ in
their spare time[1]. So, unless there's a good patch for the problem,
you can't really demand much.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]