[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: About Canvas
From: |
Alessandra Cassar |
Subject: |
Re: About Canvas |
Date: |
Fri, 18 Sep 1998 09:58:43 -0700 (PDT) |
Hi,
I am not sure it helps you, but I had a similar problem and Benedikt
Stefansson suggested me to look at this "template code".
http://www.santafe.edu/projects/swarm/users/user-community.html#use
GraphLib-1.2.tar.gz, a limited graph library with two demo apps:
Bank-1.2.tar.gz and DynamicGraph-1.2.tar.gz
Alessandra
On Fri, 18 Sep 1998, xueyue wrote:
> I wanted to test Canvas widget but fail to display
> two nodes with a link on
> the Canvas with the following code. The Canvas
> window is displayed but
> no nodes and link. My understanding is: (1) I first create two nodes
> (aNodeItem1 and a NodeItem2)
> using [NodeItem ....] and then create the link using
> [LinkItem ...], I then put
> these items into canvas, and
> finally [Canvas pack] to display. But failed, (compiling was
> successful). I guess I did not use them correctly. Could anyone point
> the errors out?
> Many thanks!
>
> ---Code--------------------
>
>
> aCanvas = [Canvas create: self];
> [aCanvas setWindowTitle: "Canvas"];
> [aCanvas setWidth: 100];
> [aCanvas setHeight: 100];
> [aNodeItem1 setX: 30 Y: 40];
> [aNodeItem1 setColor: "red"];
> [aNodeItem1 setBorderWidth: 3];
> [aNodeItem1 setString: "A"];
> [aNodeItem1 createEnd];
> [aNodeItem2 setX: 50 Y: 60];
> [aNodeItem2 setColor: "red"];
> [aNodeItem2 setBorderWidth: 3];
> [aNodeItem2 setString: "B"];
> [aNodeItem2 createEnd];
> [aLinkItem setFrom: aNodeItem1];
> [aLinkItem setTo: aNodeItem2];
> [aLinkItem setColor: "blue"];
> [aLinkItem update];
> [aLinkItem createEnd];
> [aCanvasItem setCanvas: aCanvas];
> [aCanvasItem setTargetId: a
> [aCanvasItem createEnd];
> [aCanvas pack];
>
> --
> Dr Xueyue Huang
> Center for Transport Studies
> Imperial College
> London SW7 2BU
>
> (+44) 171 594 6037
==================================
Swarm-Support is for discussion of the technical details of the day
to day usage of Swarm. For list administration needs (esp.
[un]subscribing), please send a message to <address@hidden>
with "help" in the body of the message.
==================================
- About Canvas, xueyue, 1998/09/18
- Re: About Canvas,
Alessandra Cassar <=