[squeak-dev] MenuMorph>popUpAdjacentTo:forHand:from: infelicity

tim Rowledge tim at rowledge.org
Sat Feb 8 03:41:29 UTC 2014


I’ve just swapped over to using the DockingBarThing for the menubar in my app and although it immediately showed great promise there was a strange problem; the menus were clipped by the containing menubar morph. After a bit of firking around I found MenuMorph>popUpAdjacentTo:forHand:from:  where the menu finally gets popped up with the line 

`sourceItem owner owner addMorphFront: self.`

I’m always a bit suspicious when I see code like `foo owner owner` since it has almost every time proven to be a bad way of doing what is needed, In this case it is relying upon unwarranted assumptions about where the owning morph exists and thus for me, it failed. Changing it to

`sourceItem world addMorphFront: self.`

makes it work *for me* and I think is probably more what it ought to be for a good general case. I’m a long way from being all-knowing wrt Morphic, so I’m just going to throw it out for the experts and see if it makes sense.

tim
--
tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
I'd kill for a Nobel Peace Prize.




More information about the Squeak-dev mailing list