swarm-support
[Top][All Lists]
Advanced

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

About Canvas


From: xueyue
Subject: About Canvas
Date: Fri, 18 Sep 1998 11:00:46 +0000

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

Attachment: vcard.vcf
Description: Card for Xueyue Huang


reply via email to

[Prev in Thread] Current Thread [Next in Thread]