[BUG] most uses of targetOffset are broken

Ned Konz ned at bike-nomad.com
Tue Oct 23 19:06:48 UTC 2001


There are a number of methods having to do with menu items that don't seem to 
realize that the Hand's targetOffset is relative to a Morph, not an absolute 
point. These include:

('Morph addPaintingItemsTo:hand:' 
'StringButtonMorph addCustomMenuItems:hand:' 
'StringButtonMorph setTarget:' 
'SimpleSliderMorph addCustomMenuItems:hand:' 
'SimpleSliderMorph setTarget:' 
'SimpleButtonMorph addCustomMenuItems:hand:' 
'SimpleButtonMorph setTarget:' 
'MenuMorph setTarget:'
'MovieMorph addCustomMenuItems:hand:'
 'MovieMorph insertIntoMovie:' 
'SketchMorph insertIntoMovie:'  
'ButtonProperties setTarget:')

The problem is that they contain code that usually looks like:
self world rootMorphsAt: evt hand targetOffset

which in general won't work, since evt hand targetOffset is relative to "self 
position".

Did these ever work? How?

Also, I notice that targetOffset seems to be broken enough to make even fixed 
versions of the above not work:

* yellow-button a Morph. targetOffset gets set to the offset within that 
morph where you clicked. Halos get put up.
* red-button the red (Menu) mouse halo. targetOffset gets set to a small 
point, which is apparently the offset into the halo handle itself.

So the logic in the above methods, which is (apparently) hoping that 
targetOffset relates somehow to the position of the original yellow-button 
click won't work as expected, even if the assumption about the targetOffset 
being global is fixed, except by accident (that is, if the upper-left-hand 
corner of the morph you clicked on is on top of the same Morphs that are 
under the position you actually clicked on).

-- 
Ned Konz
currently: Stanwood, WA
email:     ned at bike-nomad.com
homepage:  http://bike-nomad.com




More information about the Squeak-dev mailing list