Date: Wed, 16 Jun 2004 17:58:53 +0200 (CEST) Message-Id: <20040616.175853.31639225.andrieu at ijm.jussieu.fr> To: frido at q-software-solutions.de Cc: lablgtk at kaba.or.jp Subject: Re: Ocaml and Glade the third ;-( From: Olivier Andrieu In-Reply-To: <87pt7zd18m.fsf_-_ at fbigm.here> References: <20040528.124616.71805080.oandrieu at nerim.net> <87isefzrdg.fsf@fbigm.here> <87pt7zd18m.fsf_-_@fbigm.here> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Friedrich Dominicus [Wed, 16 Jun 2004 16:30:17 +0200]: > Ok part of my cod now looks like this: > class exchange_rate () = > object (self) > inherit window1 () > initializer > let (store, column) = make_model currencies in > let make_view_col column = > let renderer = GTree.cell_renderer_text [] in > let view_col = GTree.view_column ~title:"Currencies" () in > view_col#pack renderer ; > view_col#add_attribute renderer "text" column; > view_col in > > to_cur#set_model (Some(store :> GTree.model)); > to_cur#append_column (make_view_col column); > from_cur#set_model (Some(store :> GTree.model)); > (* from_cur#append_column (make_view_col column); *) > end > > > Now while running this with lablgtk2 I got a window with tow listvies > the right hand side is empty the left side contains the data I > expect. > > If I comment out the line with from_cur ... > I got a type error telling me: > > File "exchange_rate.ml", line 241, characters 10-56: > This expression has type int but is here used with type unit > > How could that be? It's exaclty the same line as before ... That's because #append_column returns an int (the number of the column in the view). So now the expression in your initializer has type int whereas it should be of type unit. Just add a () at the end. -- Olivier