Preferred method for updating the model behind a combobox?



To: gtk-app-devel-list gnome org
Subject: Preferred method for updating the model behind a combobox?

Hi,

Is there is a preferred method for updating the model behind a combobox
while it is displayed to avoid flicker?

Original code did:
1) Clear liststore model, changing the active item!
   > Combobox redrawn with empty contents
2) Repopulate liststore model
3) Reset active item
   > Combobox redrawn with active item selected

Found these 2 method which avoid flicker redraw:
1) Temporarly block the change signal while reconstructing the model;
2) Create a new model and assign it to the combobox replacing the
   original.
Is one method preferred over the other?  Is there another method I
should be using instead?

Thanks,
Mike

P.S.
If I appear vague it is because the code in in C++ using gtkmm, but I
don't think it matters, hence asking in this list.  Here's the current
broken code from GParted 0.19.1 Win_GParted::refresh_combo_devices()
https://git.gnome.org/browse/gparted/tree/src/Win_GParted.cc?id=GPARTED_0_19_1#n578


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