Re: attaching a callback that updates combo_box entries



On Thu, 2004-12-09 at 17:30 +0100, Stefan Kost wrote:
hi hi,

I've updated my code to use gtk_combox_box instead of option_menu. Yes, I've
read the little migration guide in the gtk+ api docs.

I must say that as soon as it gets a little dynamic gtk_combox_box_new_text() is
fairly useless. No way to rename items, re-populate the list etc.

It is a common characteristic of convenience apis that they're
convenient but restricted...

So I've chosen the hard way using an ListStore.

In the old version I attached callbacks to each menu-items label, that where
triggered by notify::id of the underlying object. mean when the objects id
changed the menu changed as well.
Now with the ComboBox I would need to change the text in the model, like
gtk_list_store_set(store,&iter,0,new_id,-1);

now the big question is what can I pass to user_data of the callback that I can
use to get store and iter from. Don't tell me I should use a struct. In that
case the design is broken - I wouldn't accept that in my code.

Can't I get the label thats behind the cell?

No you can't, simply because there may be no label.




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