NSView redisplay - what am I missing?
NSView redisplay - what am I missing?
- Subject: NSView redisplay - what am I missing?
- From: Dragan Milić <email@hidden>
- Date: Wed, 25 May 2005 08:55:15 +0200
Hello,
can someone please explain me this strange behavior: I've created my
custom NSView (actually NSControl) class, which shows some items and
other stuff. When an application crunches some data (in separate
thread), that views is constantly being updated, by talking to its
dataSource object, which in turns supply newly created items and at the
end, the whole view is redisplayed, by sending -setNeedsDisplay:
message to itself. And that's OK. In the same window, there is
NSProgressIndicator instance, which shows how data crunching is
progressing and its value is updated much more frequently than the
custom view is redisplayed. But somehow, "someone" is sending -
setNeedsDisplay: to my view, even if there's no new item to show. Just
as NSProgressIndicator is being updated, my view enters its -drawRect:
method. I confirmed that by putting log message inside that method.
Now, that's happening when creating custom view programatically. If I
instantiate it in IB (I defined -initWithCoder: method, which looks
exactly the same as -initWithFrame: for programatic creation, except
for different message sent to super, of course), my custom view behaves
just right, no superfluous redisplaying. The sole reason I create it
programatically is to put it inside NSScrollView instantiated in IB,
since I've been to lazy to create separate IB palette which includes
NSScrollView as well. I can easily solve this problem by instantiating
the view in IB, but I'm really curious whether I'm missing something. I
'd like to know what might be the reason for superfluous redisplaying
when creating view programatically.
Thanks in advance.
Milke
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden