Gtk2::ComboBoxEntry: changing the model ... what happens to the selection?
- From: Daniel Kasak <dkasak nusconsulting com au>
- To: gtk-perl-list gnome org
- Subject: Gtk2::ComboBoxEntry: changing the model ... what happens to the selection?
- Date: Wed, 06 Oct 2004 09:04:08 +1000
Hi all.
I have some code which updates a Gtk2::ComboBoxEntry's model depending
on what is happening elsewhere on the form.
I've noticed that if you have an item selected already, if you change
the model and *then* get the ID that was selected, you will still get
the previously selected item.
eg:
# Combo gets a model
$widget->set_model($model);
---
User selects an item
---
# Combo gets *another* model
$widget->set_model($model);
---
# Get the ID of the currently selected item in Combo
my $iter = $widget->get_active_iter;
if (! $iter) {
return 0;
}
my $selected_accountno = $widget->get_model->get($iter, 0);
In the above example, I will get the ID that corresponds to the item the
user selected. However if the model has changed, the item they selected
is not valid any more ( which is why I changed the model ).
Am I supposed to explicitly clear out the selection when I change the model?
If I do, that's fine. I just would have thought it would make more sense
for this to happen automatically when the model changes ( and perhaps
also clearing out the Combo's child entry text as well ).
Dan
--
Daniel Kasak
IT Developer
NUS Consulting Group
Level 5, 77 Pacific Highway
North Sydney, NSW, Australia 2060
T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989
email: dkasak nusconsulting com au
website: http://www.nusconsulting.com.au
Title: CanIt Vote for ID 111109
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]