|[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]|
On Monday, June 30, 2003, at 11:04 AM, Duncan Oliver wrote:
is that the picture I grab is grayed out, and I can't figure out why. Grabbing an image for a static progress indicator via a outlet produces a proper picture, so I can't figure it out. Here's some code for creating the picture.
The reason is simply that what you call the static progress indicator was in the active view hierarchy. Like many controls, PIs display themselves differently depending on whether they're part of the frontmost window or not. The progress bar you have dynamically created is not in the hierarchy -- is in no hierarchy at all, in fact -- so it is drawn as though it were in a background window.
While you might be able to fool it somehow, there's an much cheaper way. In fact, you've already said what you should do: get the image from a progress bar that's already in the window where the outline view is. Make it an outlet of your outline view data source. Position it outside the visible region of the window, and no one will no better. This has several advantages: when you get the image, it will automagically correctly draw its enabled/disabled version based on whether the outline view is in the top-level window or not. You also avoid the overhead of continually allocating progress bars.
Incidentally, that code has a lot of memory leaks. You never released your progress bar, you create one whether you'll need it for that column of the outline view or not, and you should autorelease the image before you return it.
Now, that's an answer to your question, but I am not sure I like this whole image thing; it would probably be pretty slow. Couldn't you create your own custom cell subclass for use in your outline view, and when drawing the cell simply pass off the drawing to a progress bar? That's a bit harder, but it would probably be worth it if you have a lot of these things.
|>Re: NSProgressIdicator Image Problems (From: Thomas Finley <email@hidden>)|
Visit the Apple Store online or at retail locations.
Copyright © 2011 Apple Inc. All rights reserved.