gtkCompletion match-selected signal callback raising bad column exception

"Jacques Le Normand" <[email protected]>
Newsgroups gmane.comp.lang.ocaml.lib.gtk
Message-ID <[email protected]>
Hello lablgtk,
I created a simple completion with a list_store containing one column of
strings. I then attached a simple match-selected callback which retrieves
the value of the row and prints it. I get this error when I try to do that:

In callback for signal match_selected, uncaught exception:
Invalid_argument("GTree.model#get: bad column")

if anyone could point out the mistake it would be great!
thanks in advance
here's the code:

open GTree
open Gobject.Data

let cols = new GTree.column_list
let col_string = cols#add string

let create_model () =
  let data = ["foo"]
  in
  let store = GTree.list_store cols in
  let fill str =
    let iter = store#append () in
    store#set ~row:iter ~column:col_string str;
  in
  List.iter fill data;
  store



let _ =
  let source_window = GWindow.window () in
  let entry = GEdit.entry ~packing:source_window#add () in
  let model = create_model () in
  let completion = GEdit.entry_completion ~model ~entry () in
    completion#set_text_column col_string;
    ignore(
      completion#connect#match_selected
    ~callback:
    (fun m i ->
       print_endline (m#get ~row:i ~column:col_string) ;
       true));
    source_window#show ();
    GMain.Main.main ()

_______________________________________________
Lablgtk mailing list
[email protected]
http://yquem.inria.fr/cgi-bin/mailman/listinfo/lablgtk
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.