Re: Canvas basics

  Hi Roger,

On Tue, 21 Dec 2004 18:52:20 +0000, Roger Leigh
<rleigh whinlatter ukfsn org> wrote:
Hash: SHA1

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

  It's a matter of what you need the canvas for.
  I've been using gnomecanvas with AA smoothly.

I've been looking at George Lebl's "Piskvorky" canvas tutorial.
(  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?

  Are you talking about canvas or world coordinates ? Canvas
coordinates are relative to the item's parent position, so if the
parent of the button you're clicking is at the top left corder, the
behavior you described is right.
  To avoid centering the canvas viewable area, use

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.

  I don't know if I understood, but you could put the row and column
labels and the canvas into a scrolledwindow.

Many thanks,

- --
Roger Leigh

                Printing on GNU/Linux?
                GPG Public Key: 0x25BFB848.  Please sign and encrypt your mail.
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <>

gtk-app-devel-list mailing list
gtk-app-devel-list gnome org

  Take care.

Arnaldo M. Pereira
egghunt at

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