Protocol viewer ?
ned at bike-nomad.com
Tue Sep 25 05:18:48 UTC 2001
On Monday 24 September 2001 08:43 pm, Gary McGovern wrote:
> Hello Ned,
> Sorry! my mistake. I should have wrote:
> bill useGradientFill
> but when looking into it I see that the method is coded to use a solid
> fill. Nevertheless:
> bill size
> brings up an error dialogue.
> The protocol is so large that I only tried a number of random messages.
> I'm curious to know the reason why 'bill size' brought up the error. Is it
> because 'size' isn't part of the protocol or some other reason?
size is defined in Object; it's not part of the Morph protocol. When you send
size to bill, you get a walkback that should explain what happened:
Receiver: an AdvancedB3DSceneMorph(3014)
bounds: 171 at 34 corner: 271 at 132
owner: a SystemWindow(1289)
fullBounds: 171 at 34 corner: 271 at 132
color: Color transparent
extension: a MorphExtension (368) [locked] [other: (layoutFrame -> a
LayoutFrame) (layoutProperties -> a LayoutProperties)]
scene: a B3DScene
Method (temp) variables:
aString: 'AdvancedB3DSceneMorphs are not indexable'
Note the "(Object)" in the call stack; this shows you that the size method
that is being called is defined in Object. This can't be the right one, since
Objects don't know about physical size in pixels (it would have to be in
Morph or a subclass).
> I've been bringing up the protocol browser through the menu icon and it is
> certainly for the correct class.
Well, then, what you probably want to do is to restrict the extent of the
protocol. By using the second button from the left, and selecting Morph, you
won't see the methods from Object, most of which aren't particularly
interesting if you're trying to do 3D or Morphic things. Or choose just the
class in question, or whatever other view you want to see.
If you're trying to examine the size in pixels of the Morph, you should look
at an Inspector (choose "inspect morph"), and note that there is an instance
variable called bounds that is a Rectangle. Now you can look for a method
that will return the extent of that rectangle. Either choose the instance
variable bounds in the Inspector and select "method refs to this inst var",
or in the Protocol Browser, hit the menu button (the left-most one) and
choose "inst var refs". You'll get a list of methods in either case that look
at the bounds variable.
Look through this list until you find "extent", which will return the extent
of the bounds rectangle. Or "width", or "height".
currently: Stanwood, WA
email: ned at bike-nomad.com
More information about the Squeak-dev