Hello again,
I'm currently facing a problem (or maybe I'm to blind to see my error). I try to fill a GtkComboBox (with the "Text" Version, everything works, but I'd like to use the part with the seperate model) with the following code: ---snipp-- listModel := GTK.GtkListStore new: 1 varargs: {GTK.GValue gTypeString}. iterator := GTK.GtkTreeIter new. listModel append: iterator; setOop: iterator column: 0 value: 'One'. iterator := GTK.GtkTreeIter new. listModel append: iterator; setOop: iterator column: 0 value: 'Two'. iterator := GTK.GtkTreeIter new. listModel append: iterator; setOop: iterator column: 0 value: 'Three'. combobox := GTK.GtkComboBoxEntry new. combobox setModel: listModel; setActive: 1. ---snipp--- And I see, that the ComboBox contains 3 entries (through the space, which is used if the ComboBox is opened) But all entries are empty. Maybe you can point me to my mistake? Thanks in advance, Joachim. _______________________________________________ help-smalltalk mailing list [hidden email] http://lists.gnu.org/mailman/listinfo/help-smalltalk |
> And I see, that the ComboBox contains 3 entries (through the space, > which is used if the ComboBox is opened) But all entries are empty. I think you need to connect the text of the combobox to column 0 of the model? (See example-tree.st). Regarding the other question, you can look for the implementor of "narrow" in the bindings and change that to GObject. But it may not be the problem, I need to look at it -- will get back to you next week. Paolo _______________________________________________ help-smalltalk mailing list [hidden email] http://lists.gnu.org/mailman/listinfo/help-smalltalk |
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? > Regarding the other question, you can look for the implementor of > "narrow" in the bindings and change that to GObject. But it may not be > the problem, I need to look at it -- will get back to you next week. Don't worry, the main thing is, that I'll will get through it with a solution that is suitable. B.T.W.: did today some work for the company I work for and after writing code like this: for (Object result: nqResults) { int prVtNr = ((Integer) ((Vector)result).get(0)).intValue(); I know, that smalltalk is attracting me more and more each day I dig into it. ('till now, I didn't know it better...) Regards, Joachim. _______________________________________________ help-smalltalk mailing list [hidden email] http://lists.gnu.org/mailman/listinfo/help-smalltalk |
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 _______________________________________________ help-smalltalk mailing list [hidden email] http://lists.gnu.org/mailman/listinfo/help-smalltalk |
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 > > _______________________________________________ help-smalltalk mailing list [hidden email] http://lists.gnu.org/mailman/listinfo/help-smalltalk |
> 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)> > ] > ] Aha, this is because interfaces are still not supported by the automatic binding generator. I'll add something. Paolo _______________________________________________ help-smalltalk mailing list [hidden email] http://lists.gnu.org/mailman/listinfo/help-smalltalk |
Free forum by Nabble | Edit this page |