swarm-support
[Top][All Lists]
Advanced

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

Re: Probing structured variables


From: Ken Cline
Subject: Re: Probing structured variables
Date: Sat, 8 May 1999 15:28:29 -0400 (EDT)

On Sat, 8 May 1999, Marcus G. Daniels wrote:

> >>>>> "WS" == William S Shu <address@hidden> writes:
> 
> WS> I want to use probeMaps on MyClass so as to be able
> WS> to change position.x and position.y.  How do I do it? 
> 
> Structures are not supported by VarProbe.  However, you
> can make an object called Point, and then create a
> ProbeDisplay for that.

I agree with Marcus.  It been my experience that in the long
run your code will be much easier to change/enhance if you
just go with an object instead of a struct.

However, for the quick fix, try adding a method called
`setX:Y:' to MyClass and probing it.  The method hides
whether you are using a struct or object *and* can be used
to error check.  A set method could even take symbolic
values (e.g. "MAXIMUM") if you want to get fancy!

> WS> More generally, How can one display composite
> WS> variables, including collection objects, such as
> WS> arrays?
> 
> MultiVarProbeDisplay will display of a list of objects,
> but the object components have to conform to the same
> ProbeMap.
> 
> WS> Also, can one display in the same panel instances
> WS> that are not of the same class?
> 
> Of course, generically typed `id' instance variables can
> contain any instances of any class, but you'll only see
> the reference widget to click on, not the expansion of the
> variables.  If you want that, you'll have to compose the
> widgets you want one by one inside a Canvas.

Some other ideas... If your class contains a Collection you
can quickly add a `getNext' method and `probeCurrent'
method; implement `getNext' so it "wraps around" the bottom
of the collection.  You'll also need a collection index
stored in a instance variable (ivar), i.e. not local.

Now probe the `getNext' and `probeCurrent' methods.  So you
can hit `getNext' to find the member of the collection you
want then create a probe display with the `probeCurrent'
method.  (Just a little hack-ish. ;-)


_________________________________________________________
Ken Cline                             address@hidden
SAIC                                 VOICE (410) 571-0413
Annapolis, MD                          FAX (301) 261-8427




                  ==================================
   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.



reply via email to

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