Delivered-To: lablgtk at yquem.inria.fr DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:mime-version:content-type; bh=oZaLVxLrQTQvonjyRzPpMKjh25w1yr+Ffx3d7/72vH8=; b=mvGwoCySXqBaM0786LIKCyVn5uBe00smeCZx/ZAKKMJwKGkvxq4ZD21thcN61dd/jT xr89vgwA5Ml9J0+iCKtSM/p8cnFrdWSSuctqcr3OsGQlKi4frYCBfnvS2OcOZLD8eqov IyXpI6QClxGr5NZbi2km13T8T5MPhmWwJXkLc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type; b=DwdpkV7oSrYQPDF2/gCB3YmmZDJDss9h8+3rbtZfy8g+GYmcKEifjfoGfD63tE70ip J8qSvv3GBEqd9xDumUDBFxBoCApLB5C39kPrT6EijcAVqUHYN1a6TOf7bwHJZL2n0lls PVLcf46GBgH12V+QRSR7NVrMqx6HK055t4lGM= Message-ID: Date: Fri, 3 Oct 2008 21:28:53 -0400 From: "Jacques Le Normand" To: lablgtk at yquem.inria.fr MIME-Version: 1.0 Subject: [Lablgtk] gtkCompletion match-selected signal callback raising bad column exception Mime-version: 1.0 Content-Type: multipart/mixed; boundary="===============1220236878==" Content-Length: 3693 --===============1220236878== Content-Type: multipart/alternative; boundary="----=_Part_16170_32471434.1223083733100" ------=_Part_16170_32471434.1223083733100 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline 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 () ------=_Part_16170_32471434.1223083733100 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline
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 ()
   


------=_Part_16170_32471434.1223083733100-- --===============1220236878== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Lablgtk mailing list Lablgtk@yquem.inria.fr http://yquem.inria.fr/cgi-bin/mailman/listinfo/lablgtk --===============1220236878==--