Date: Fri, 27 Aug 2004 10:06:36 +0200 (CEST) Message-Id: <20040827.100636.25452662.oandrieu at nerim.net> To: mike at halcrow.us Cc: lablgtk at kaba.or.jp Subject: Re: Combo entry_completion? From: Olivier Andrieu In-Reply-To: <20040827032542.GA4244 at halcrow.us> References: <20040826004336.GB22131 at halcrow.us> <20040826.204051.74729746.oandrieu@nerim.net> <20040827032542.GA4244@halcrow.us> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Michael Halcrow [Thu, 26 Aug 2004]: > On Thu, Aug 26, 2004 at 08:40:51PM +0200, Olivier Andrieu wrote: > > Michael Halcrow [Wed, 25 Aug 2004]: > > > > To use completion with a combo box entry, it goes somehow like this: > > > > > > > > ,---- > > > > | let make_combo_box_entry_with_completion packing strings = > > > > | let (combo, (model, column)) = GEdit.combo_box_entry_text ~strings ~packing () in > > > > | let entry = combo#entry in > > > > | let completion = GEdit.entry_completion ~model ~entry () in > > > > | completion#set_text_column column ; > > > > | (combo, entry, completion) > > > > `---- > > > > > > That worked wonderfully. But I also need to be able to dynamically > > > replace the contents of the list. With the old combo box, that's just > > > a matter of manipulating combo#list. It isn't immediately obvious to > > > me how to go about doing the same on the combo w/ entry completion. > > > > well it's about the same, you modify the model (cf GtkListStore > > API). For instance to add an element: > > > > model#set ~row:model#append ~column data > > So data is of type 'a GTree.column, which is defined: no, no data is of type string, because column, which comes from the call to GEdit.combo_box_entry_text is of type `string column'. > Forgive me if this is supposed to be obvious, but could you give me > a simple example of how to (1) clear the list and (2) append a > string onto this list? Or maybe just some good background reading > material? :-) let (combo, (store, column)) as text_combo = GEdit.combo_box_entry_text ~strings ~packing () in 1) -> store#clear () 2) -> GEdit.text_combo_add text_combo "my string" for background reading material, you have: - the overview of GtkTreeModel & co. in the GTK+ manual: http://developer.gnome.org/doc/API/2.0/gtk/TreeWidget.html - the GTK+ 2.0 Tree View Tutorial: http://scentric.net/tutorial/ -- Olivier