Re: Populating A Combo Box With Integers In Hex
- From: David Nečas <yeti physics muni cz>
- To: Tristian Celestin <tristian celestin outlook com>
- Cc: "gtk-app-devel-list gnome org" <gtk-app-devel-list gnome org>
- Subject: Re: Populating A Combo Box With Integers In Hex
- Date: Sat, 7 Dec 2013 19:23:48 +0100
On Sat, Dec 07, 2013 at 05:54:23PM +0000, Tristian Celestin wrote:
I have a GtkListStore that contains 4 columns of unsigned integers
(G_TYPE_UINT). I would like to display the second column of integers
in a GtkComboBoxText widget, and I would like the integers to be
displayed in Base 12.
I would stop here and use normal GtkComboBox with a cell data function
(gtk_cell_layout_set_cell_data_func()) such as
static void
render_base12(GtkTreeViewColumn *column,
GtkCellRenderer *renderer,
GtkTreeModel *model,
GtkTreeIter *iter,
gpointer data)
{
guint value;
gtk_tree_model_get(model, iter, 1, &value, -1);
/* format the value here in base 12 */
g_object_set(renderer, "text", formatted_value, NULL);
}
It may be possible to do this with GtkComboBoxText too. I don't know.
If I want something non-default I just use the real thing instead of
studying what is and what isn't allowed with GtkComboBoxText.
Regards,
Yeti
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]