swarm-support
[Top][All Lists]
Advanced

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

return type for a method parameter & assigning probe buttons


From: William S. Shu
Subject: return type for a method parameter & assigning probe buttons
Date: Tue, 07 Sep 1999 19:39:43 +0100

Please help me on the following.  They are probably naive, but they niggle
and my search not successful!

Problem 1: Objective-C)  How can one pass a method as an argument as well
as the type of its return value?  I can do that for functions, but it is
not convenient.  The code where I have the the problem is:


// return value of neighbourhood (defined by bL and tR). It is the sum ...

// valueOf takes *no* argument
- (Real)getValueBL: (Point)bL TR: (Point)tR
      class: (id)aClass  order: (int)type value: (SEL)valueOf {
  id obj;
  int i, j;
  Real val;
...
      obj = [self getWorldObjectAtX: i Y: j];
      if ([obj isKindOf: aClass]) {
        ....
        val += [obj valueOf]    <====== **** return type assumed to be id
***
    }
....

return val;
}



Problem 2:) I want to probe a Person object and a Mosquito object by
clicking the right mouse button.  Unfortunately, it seems only the last
executed setButton:Client:Message: command is obeyed.  My question is/are:

    How do I get to probe both objects (in fact any object) on the raster
by using the same mouse button.

Assuming I succeed to enable the mouse clicks, how do I selectively
disable them?

The code is:
  // Also, tell the world raster to send mouse clicks to the
  // personDisplay and the MosquitoDisplay.  This allows the user to
right-click on
  // the display to probe the person and mosquito objbects.

  // for Person
  [worldRaster setButton: ButtonRight   // use Right button
               Client: personDisplay
               Message: M(makeProbeAtX:Y:)];


  //for Mosquito
  [worldRaster setButton: ButtonMiddle   // use Middle button
               Client: mosquitoDisplay
               Message: M(makeProbeAtX:Y:)];



Thanks,

William


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