Re: Combobox and columns

That should be the solution. Meanwhile I found my exactly problem and
the solution

This is the same as from you but in C.
I will try now in my code...

Thanks a million,

Am 03.04.2017 um 02:24 schrieb Daniel Kasak:
This bit is a little non-obvious. The related documentation is:

So you can pass various attributes into the renderer / cell layout /
whatever. I'm still slightly confused by it, but I can make it work :)

In perl, I have a convenience method for setting up renderers for
combos with multi-column models:


sub create_combo_renderers {

    my ( $self, $widget, $text_column, $icon_column ) = @_;

    if ( $icon_column ) {
        my $renderer = Gtk3::CellRendererPixbuf->new;
        $widget->pack_start( $renderer, FALSE );
        $widget->set_attributes( $renderer, pixbuf => $icon_column );

    my $renderer = Gtk3::CellRendererText->new;
    $widget->pack_start( $renderer, FALSE );
    $widget->set_attributes( $renderer, text => $text_column );



It's the last line:
$widget->set_attributes( $renderer, text => $text_column );
 ... that tells the renderer / cell layout which column to use.


On Mon, Apr 3, 2017 at 8:33 AM, Eric Cashon via gtk-list
<gtk-list gnome org> wrote:
Hi Axel,

How do you want to change the list column combo in your program?

If you use a combo2 box row to change a combo1 box column from a list you
might have a "changed" callback that looks something like the following.


GtkCellRenderer *renderer=NULL;
static void change_column(GtkComboBox *combo2, GtkComboBox *combo1)
    gint row=gtk_combo_box_get_active(combo2);
GTK_CELL_RENDERER(renderer), "text", row, NULL);

-----Original Message-----
From: axel <axel voges freenet de>
To: gtk-list <gtk-list gnome org>
Sent: Sun, Apr 2, 2017 6:39 am
Subject: Combobox and columns

Have a liststore with 4 columns. And a combobox with a cellrenderer.
UI made with Glade. Programm is written in C.

How to choose one of the columns out of the liststore to use/show in the
I can set in Glade the actual column but I need it to be done on runtime.


gtk-list mailing list
gtk-list gnome org

gtk-list mailing list
gtk-list gnome org

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