help-smalltalk
[Top][All Lists]
Advanced

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

Re: [Help-smalltalk] GtkComboBox doesn't understand me...


From: Joachim Jaeckel
Subject: Re: [Help-smalltalk] GtkComboBox doesn't understand me...
Date: Sun, 31 May 2009 13:49:08 +0200
User-agent: Mozilla-Thunderbird 2.0.0.19 (X11/20090103)

Hello Paolo,

thanks for your support! :-)

I got it! :-D

But maybe I've a small extension to the ComboBox Object. But please read on:

The source-code you send, brought me to the right place to look. I had completely overseen the CellRenderer part. But the ComboBox doesn't provide an "insertColumn" method. So I tried to look for a GTK-Tutorial, which handles these. On the gtk.org WEB-Site, the tutorial about a ComboBox doesn't subscribe the "model way", so I had to look on other places. I found a pygtk-description where I saw that they provide a Method "packStart" to the ComboBox. And I found a C-source which does a "gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo), cell, TRUE);"

So the solution would be (I don't know, if it's the right place for the methods or if you would place them to another class, but it's likely to the pygtk description) an extension for the ComboBox like this one:

GTK.GtkComboBox extend [

    packStart: cell expand: expand [
        <cCall: 'gtk_cell_layout_pack_start' returning: #void
            args: #( #self #cObject #boolean )>
    ]

    addAttribute: cell attribute: attribute column: column [
        <cCall: 'gtk_cell_layout_add_attribute' returning: #void
            args: #( #self #cObject #string  #int)>
    ]
]

or would you prefer somthing like setLayout to the comboBox which handles a GtkCellLayout, but I don't know how this could be managed, currently.

Regards,
Joachim.

Paolo Bonzini schrieb:
Joachim Jaeckel wrote:
Hello Paolo,

thanks for your answer!

I think you need to connect the text of the combobox to column 0 of the
model?  (See example-tree.st).
But isn't that, which I did with:
"setOop: iterator column: 0 value: 'One'." ?

Or am I wrong?

The model is a table of information, but you have to connect the model
to the view explicitly.  Here is the relevant code for GtkTreeView, I
think it should be similar for comboboxes:

        col := GtkTreeViewColumn new.
        treeView insertColumn: col position: -1.
        col setTitle: 'Class'.
        col packStart: (rend := GtkCellRendererText new) expand: true.
        col
            addAttribute: rend
            attribute: 'text'
            column: 1.
        treeView setModel: tree.

Paolo







reply via email to

[Prev in Thread] Current Thread [Next in Thread]