2008 05 26Zero Opacity Trick
- draw whatever kind of control you want in Photoshop
- overlay a zero opacity control over it
- then your custom control will behave like the one you're styling : the browser handles mouse clicks for transparent elements just as if they were fully visible.
And, we can do the same in Cocoa ! Namely, put a transparent control over a custom view and have the custom view behave as that transparent control.
In that case, I wanted to have that context menu pop exactly underneath that gray view. Couldn't figure out how to do it, tried the CSS zero opacity trick, and … it almost worked, trailing some repainted trash behind. After enabling Core Animation for the gray view, everything worked OK.There must be some better way of doing that :), but it's pretty amazing to see how well JS+CSS concepts are close to Cocoa's.