On 14.03.2008, at 13:11, Uli Kusterer wrote:
On 14.03.2008, at 09:11, Ben Lachman wrote:
I think I finally solved this while chatting with Wil Shipley earlier this evening. Wil mentioned sometimes needing to display from the opaque ancestor which is basically what I was trying to do with the code Uli questioned. The way I was doing it was only partially successful at best. Given Wil's hints, I added the following to my drawing code and my drawing glitches are no more:

- (void)drawRect:(NSRect)rect {
        static BOOL toggle = YES;
        
        if( toggle ) {
                toggle = NO;
                [[self opaqueAncestor] display];
                return;
        } else {
                toggle = YES;
        }
...

Urk. That does not sound like a good idea at all. display is supposed to eventually call -drawRect:, and also the -drawRect: of any subviews that might need redrawing. Calling display inside - drawRect: is essentially requesting an endless recursion from Apple. Even if it works now due to some fortunate optimization or whatever Apple put in, I don't think this is a good idea going forward.


Oh great, so this message *did* get through even though I canceled and it didn't get saved to my outbox...

Anyway, of course your "toggle" prevents the endless loop, but it's still an ugly hack. Not to mention a bad way to name such a variable. So, why exactly do you have a subview in a text view, and why aren't you a text attachment or something similar? And isn't there a better place to call display than drawRect:? Have you made sure your text view and your image view and any of the partially transparent views in between are not marked opaque like Ken Ferry suggested? Or if you want some of them to be opaque, have you made sure they actually erase their background appropriately?

I really think you're just going about this the wrong way. What exactly are you trying to do in a high-level way? Are you trying to do text layout that flows around an image? Are you trying to show text behind an image? Are you trying to embed a picture in an image?

Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de





_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to