[Lablgtk] drawing a rectangle in a textview

Jacques Le Normand rathereasy at gmail.com
Wed May 14 03:07:48 CEST 2008

Hello lablgtk,
I'd like to draw a coloured, transparent rectangle in a textview (to
highlight some text)
the following page gives a method (which I'm having trouble translating to

(from http://www.mail-archive.com/gtk-app-devel-list@gnome.org/msg09087.html)

win = gtk_text_view_get_window(text,
      gc = gdk_gc_new(win);
      gdk_color_parse("red", &color1);
      gdk_gc_set_foreground(gc, &color1);
      gdk_color_parse("black", &color2);
      gdk_gc_set_background(gc, &color2);
      gdk_gc_set_fill(gc, GDK_SOLID);

      gdk_draw_rectangle(win, gc, TRUE, 1, 1, 20, 20);

However, I can't figure out how to call get_window on textview (namely, how
to get a [> 'textview ] Gtk.obj). Feel free to warn me about other snags!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ocamlcore.org/pipermail/lablgtk-list/attachments/20080513/9e5d9fc1/attachment.htm>
-------------- next part --------------
Lablgtk mailing list
Lablgtk at yquem.inria.fr

More information about the Lablgtk-list mailing list