Re: Background image

Richard Jones <[email protected]> Mon, 5 Jul 2010 22:22:08 +0100
Newsgroups gmane.comp.lang.ocaml.lib.gtk
Message-ID <[email protected]>
On Tue, Jun 29, 2010 at 09:41:19PM +0200, Serge Le Huitouze wrote:
> I have a legacy image representing an approximate map.
> 
> I want to superimpose a grid on it, and put circles of different size/color
> in the individual squares based on some text data I'll read in a file.
> 
> Then, I want to be able to change circles of an individual square
> simply by clicking on it (thus, cycling through the different circles
> available).
> 
> Problem:
> I'm trying to adapt the "scribble.ml" example from
> http://plus.kaist.ac.kr/~shoh/ocaml/lablgtk2/lablgtk2-tutorial/a2692.html#AEN2697
> 
> I thought it'd be a good starting point, since this code draws little
> black squares
> inside a window. I figured adding my background image would do the trick...
> I managed to make my background image visible (by adding a call to
> "drawing#pixbuf"
> in the "expose" function), but then I don't see the little black squares!
> 
> All other fiddlings I tried were unsuccessful at even making appear my
> background
> image!

Bit confused about what went wrong.  But I have done this in the past
with lablgtk using a scrolled drawing_area and just doing
da#put_pixmap before drawing all the other things on top.

This is really a Gtk problem, not lablgtk specific in any way.  Gtk
drawing areas are terribly complicated and I've often found it's a
matter of randomly trying stuff until it works, but it should
(eventually) work ...

Rich.

-- 
Richard Jones
Red Hat