drawing in a textview
"Jacques Le Normand" <[email protected]>
| Newsgroups | gmane.comp.lang.ocaml.lib.gtk |
|---|---|
| Message-ID | <[email protected]> |
I'm trying to draw a rectangle on a textview, as in: http://www.mail-archive.com/[email protected]/msg09087.html and I came up with open Gobject let _ = let source_window = GWindow.window () in let buffer = GText.buffer () in let view = GText.view ~buffer:buffer ~packing:source_window#add () in source_window#show (); source_window#maximize (); let drawing_to = match view#get_window `WIDGET with Some a -> a | None -> raise (Failure "unexpected") in let gc = Gdk.GC.create drawing_to in let red = Gdk.Color.alloc (Gdk.Color.get_system_colormap ()) (`NAME "red") in Gdk.GC.set_foreground gc red; Gdk.GC.set_background gc red; Gdk.GC.set_fill gc `SOLID; Gdk.Draw.rectangle drawing_to gc ~x:10 ~y:10 ~width:300 ~height:400 ~filled:true (); Gdk.Draw.line drawing_to gc 5 5 100 100; GMain.Main.main (); unfortunately, nothing gets drawn. Anyone have any suggestions? --Jacques _______________________________________________ Lablgtk mailing list [email protected] http://yquem.inria.fr/cgi-bin/mailman/listinfo/lablgtk