Message-ID: <43E0BB69.9080509 at crans.org> Date: Wed, 01 Feb 2006 14:45:13 +0100 From: =?ISO-8859-1?Q?=22Sayan_=28S=E9bastien_Li-Thiao-T=E9=29=22?= MIME-Version: 1.0 To: lablgtk at math.nagoya-u.ac.jp Subject: Drawing curves in a GPack.layout Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Hi, I am trying to program an application to display and edit a tree with nodes containing text. I use a GPack.layout container and I add each node of the tree to the container in a GText.view. This gives multiline text nodes and one can distinguish the tree structure thanks to careful positionning of the nodes. However, I have had no success so far with drawing the edges of the tree. Using a drawable area created from layout#misc#window does not work, and the gtk2+ manual states: "When handling expose events on a GtkLayout, you must draw to GTK_LAYOUT (layout)->bin_window, rather than to GTK_WIDGET (layout)->window, as you would for a drawing area." Could someone help me with drawing in the GPack.layout or suggest another program structure? Here is a simple example where drawing in a GPack.layout does not work. let locale = GtkMain.Main.init ();; let window = GWindow.window ~title:"OcamlMMap" () ;; window#connect#destroy ~callback:GMain.Main.quit;; window#event#connect#delete ~callback:(fun _ -> GMain.Main.quit (); true);; (*let drawing_area = GMisc.drawing_area ~packing:window#add ();;*) (*works*) let drawing_area = GPack.layout ~packing:window#add ();; (*does not work *) let drawing = drawing_area#misc#realize (); new GDraw.drawable (drawing_area#misc#window) ;; drawing#set_foreground `BLACK;; drawing#set_line_attributes ~width:5 ();; let redraw _ = drawing#rectangle ~x:(-10) ~y:(-10) ~width:200 ~height:200 ~filled:true () ; drawing#line ~x:0 ~y:0 ~x:200 ~y:300; false;; drawing_area#event#connect#expose ~callback:redraw;; window#misc#show ();; Printexc.print GMain.Main.main ();; -- Li-Thiao-Té Sébastien