Delivered-To: garrigue at math.nagoya-u.ac.jp Authentication-Results: mailhost.math.nagoya-u.ac.jp sender=lablgtk-bounces at yquem.inria.fr; domainkey=neutral (no query protocol specified; no policy for yquem.inria.fr) 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:mime-version:received:date:message-id:subject :from:to:content-type; bh=/ZSqVx/nhq4yJ8+/deAUqTfsg1VY8rBVEmxAQOAv14s=; b=MJvnrifLA+fkG5SBVZ82HjISzOn1495YXaX5WAAaVZg72rBx4X5j2wSLWB6IKntCCM bVtWWq01ghu955GxWCtA6+0FCAZbcVcl7u7G2MptdZw25fAq0tXYOu04+vxC5n2u2kU0 6H90UJ7A5tARlBsEQIacxpd0xoezQxbOIDL5U= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=OJ8lgkhprKsqOEtYZCtOetFYxAT91CKd/+k60+2i3SboVgDXLMDWUcVEJWcJrHDzdQ xFhcLZIcUrfIlWUjVcl1WyaW7W4RJqx6+pOUE8G/3a/Hy6I5y9Xz1q6Y6eTRxwEu+4gi FgYeHtFHhiew1SmzX9IHeWYoTLnAf+5Y4zlhw= MIME-Version: 1.0 Date: Wed, 4 Mar 2009 22:04:52 -0500 Message-ID: From: Jacques Le Normand To: lablgtk at yquem.inria.fr Subject: [Lablgtk] gnome canvas and a text view Content-Type: multipart/mixed; boundary="===============0775262646==" Mime-version: 1.0 --===============0775262646== Content-Type: multipart/alternative; boundary=00163646c13c95292c0464566e75 --00163646c13c95292c0464566e75 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit dear list, I'm place a text_view in scrolled_window in a gnome canvas. Everytime the buffer of the text view changes, I want a label to be placed right under the end of the buffer. I cooked up some code. The code has four problems: 1) the label is not placed in the correct location 2) the label is blocked by the text view 3) the scrolled_window is not placed at the top left corner of the gnome canvas 4) the scrolled_window does not take the entire gnome canvas (I want the gnome canvas to hug the scrolled_window) is it possible to fix these problems? cheers --Jacques let _ = let source_window = GWindow.window () in let buffer = GText.buffer () in let canvas = GnoCanvas.canvas ~show:true ~packing:source_window#add () in let scrolled_window = GBin.scrolled_window () in let view = GText.view ~buffer:buffer ~show:true ~packing:scrolled_window#add_with_viewport () in let _ = GnoCanvas.widget ~widget:scrolled_window ~width:200.0 ~height:200.0 canvas#root in let label = GMisc.label ~text:"you're editing here" () in let label_as_item = GnoCanvas.widget ~widget:label ~width:150.0 ~height:100.0 canvas#root in let changed_callback _ = let last_iter = buffer#end_iter in let rect = view#get_iter_location last_iter in let x = float_of_int (Gdk.Rectangle.x rect) in let y = float_of_int (Gdk.Rectangle.y rect) in label_as_item#move ~x:x ~y:y in label_as_item#show (); ignore(buffer#connect#changed ~callback:changed_callback); buffer#insert "some text"; source_window#show (); source_window#maximize (); GMain.Main.main () --00163646c13c95292c0464566e75 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable dear list,
I'm place a text_view in scrolled_window in a gnome canv= as. Everytime the buffer of the text view changes, I want a label to be pla= ced right under the end of the buffer. I cooked up some code. The code has = four problems:

1) the label is not placed in the correct location
2) the label is b= locked by the text view
3) the scrolled_window is not placed at the top = left corner of the gnome canvas
4) the scrolled_window does not take the= entire gnome canvas (I want the gnome canvas to hug the scrolled_window)
is it possible to fix these problems?
cheers
--Jacques

let= _ =3D
=A0 let source_window =3D GWindow.window () in
=A0 let buffer = =3D GText.buffer () in
=A0 let canvas =3D GnoCanvas.canvas ~show:true ~p= acking:source_window#add () in
=A0 let scrolled_window =3D GBin.scrolled_window=A0 ()=A0 in
=A0 let vie= w =3D
=A0=A0=A0 GText.view ~buffer:buffer ~show:true ~packing:scrolled_= window#add_with_viewport=A0 ()=A0 in
=A0 let _ =3D
=A0=A0=A0 GnoCanv= as.widget ~widget:scrolled_window=A0 ~width:200.0 ~height:200.0=A0 canvas#r= oot in
=A0 let label =3D GMisc.label ~text:"you're editing here" () = in
=A0 let label_as_item =3D GnoCanvas.widget ~widget:label=A0 ~width:1= 50.0 ~height:100.0 canvas#root in

=A0 let changed_callback _ =3D =A0=A0=A0 let last_iter =3D buffer#end_iter in
=A0=A0=A0 let rect =3D view#get_iter_location last_iter in
=A0=A0=A0 let= x =3D float_of_int (Gdk.Rectangle.x rect) in
=A0=A0=A0 let y =3D float= _of_int (Gdk.Rectangle.y rect) in
=A0=A0=A0=A0=A0 label_as_item#move ~x= :x ~y:y
=A0 in
=A0=A0=A0 label_as_item#show ();
=A0=A0=A0 ignore(buffer#connect#changed ~callback:changed_callback);
=A0= =A0=A0 buffer#insert "some text";
=A0=A0=A0 source_window#show= ();
=A0=A0=A0 source_window#maximize ();
=A0=A0=A0 GMain.Main.main (= )

--00163646c13c95292c0464566e75-- --===============0775262646== 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 --===============0775262646==--