Canvas basics



[I originally posted this to gtk-app-devel-list, but I'm not sure that's
the best place.]

Is the Canvas on-topic for this list?  If so, I have a few basic
questions about it, which I hope are simple :)

Firstly, which Canvas implementation should I be using?  I've tried
libgnomecanvas2, but I see there's also a FooCanvas, and a GtkCanvas
(GTK+ 1.2 only?).  Is the AA canvas still experimental and not
recommended?

I've been looking at George Lebl's "Piskvorky" canvas tutorial.
(ftp://ftp.5z.com/pub/unix/gnome-piskvorky-1.tar.gz)  After
tweaking the Makefile to use pkg-config, this built fine with
GTK+ 2.4/GNOME 2.8.  However, I did find a problem: if I resize the
window, the canvas viewable area becomes centred in the canvas widget,
but the coordinates of button presses are still relative to the top left
corner of the canvas widget, rather than the canvas view itself.  How
should I compensate for this in the code?  Or is this a canvas bug,
since the events are outside the drawable area?

What I really want to do with the canvas is create a grid display
system, similar to Gnumeric, but probably much simpler.  What I want to
do is achieve the same scroll behaviour as Gnumeric: the row and column
labels scroll with the canvas, and scrolling is in discrete steps.  How
should I do this.  I thought of two possible methods:
- packing four canvas widgets into viewports in a GtkTable and tying
  their adjustments to the same scrollbars.
- overlaying the row/column headings on top of the canvas relative
  to the scroll position.
How does Gnumeric do this?  I had a look, but couldn't find the
relevant source files.


Many thanks,
Roger

-- 
Roger Leigh

                Printing on GNU/Linux?  http://gimp-print.sourceforge.net/
                GPG Public Key: 0x25BFB848.  Please sign and encrypt your mail.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]