[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Another Tk/Tcl error...
From: |
Darren Schreiber |
Subject: |
Re: Another Tk/Tcl error... |
Date: |
Wed, 22 Sep 1999 22:37:55 -0700 |
Fortunately, this error must have just been a fluke. I took the program to
our school computer lab this morning and it worked fine. When I brought it
back to my home computer, everything worked well. Thank god too cause
hunting down the last tk/tcl error was a nightmare.
Darren
>>>>>> "DS" == Darren Schreiber <address@hidden> writes:
>
>DS> (Tcl -eval:) syntax error in expression "( - ) / 2" while
>DS> executing "lindex $temp 1" while evaluating: set temp
>DS> [.w0x496ca18.w0x496b7c8 bbox 34]; set h [expr ([lindex $temp 3] -
>DS> [lindex $temp 1]) / 2]
>
>There must be something weird about either the text you create for the
>node or the canvas itself. It's apparently failing to find the
>bounding box of the text, or the numbers it returns are syntactically bad.
>
>The thing to do is to close off a conservative perimeter and then
>squeeze it until the critter makes a run for it. (Sometimes you'll
>find the bug just growing the perimeter.)
>
>Further, if you want help drawing the perimeter, it's important to make an
>effort to have a common basis for communication. The program below is
>adapted from your code and works for me. How are things different in
>your context?
>
>#import <simtools.h>
>#import <gui.h>
>#import <defobj/Create.h>
>
>@interface Target: CreateDrop
>@end
>
>@implementation Target
>@end
>
>
>int
>main (int argc, const char **argv)
>{
> id <Canvas> aCanvas;
> id <NodeItem> agentNode;
> id target;
>
> initSwarm (argc, argv);
>
> aCanvas = [Canvas create: globalZone];
> [aCanvas setWidth: 400 Height: 400];
> [aCanvas setWindowTitle: "Canvas"];
> [aCanvas pack];
>
> target = [Target create: globalZone];
>
> {
> char aName[10];
> int agentID = 5;
>
> sprintf(aName,"C%d", agentID);
>
> agentNode = [OvalNodeItem createBegin: globalZone];
> [agentNode setCanvas: aCanvas];
> [agentNode setX: 100 Y: 100];
> [agentNode setString: aName];
> [agentNode setFont: "{Arial 6}"];
> [agentNode setTargetId: target];
> agentNode=[agentNode createEnd];
> [agentNode setColor: "tan"];
> [agentNode setBorderColor: "pink"];
> [agentNode setBorderWidth: 1];
> }
> while (1) { while (GUI_EVENT_ASYNC ()) {} }
>}
>
>/*
>Local Variables:
>compile-command: "gcc -o canvas3 -g -Wno-import -L//D/Swarm-1.4.1/lib
>-I//D/Swarm-1.4.1/include canvas3.m -lanalysis -lsimtools -lsimtoolsgui
>-lactivity -ltkobjc -lrandom -lobjectbase -ldefobj -lcollections -lmisc
>-ltclobjc -lBLT8.0 -ltk80 -ltcl80 -luser32 -lgdi32 -lpng -lz -lavcall -lm
>-lobjc"
>End:
>*/
>
> ==================================
> 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.
_____________________________________________
Darren Schreiber
Attorney at Law
Graduate Student
Political Science, UCLA
address@hidden
==================================
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.