Re: [Newbie] Redraw design problem
Re: [Newbie] Redraw design problem
- Subject: Re: [Newbie] Redraw design problem
- From: Buddy Kurz <email@hidden>
- Date: Thu, 5 Jun 2003 18:52:54 -0700
Are you using [myView setNeedsDisplayInRect:objectRect] ?
This adds to the refresh region for the view which would then get
displayed by your implementation of drawRect: at the end of the event
loop (hopefully after all of the object notifications have been
processed)
On Thursday, June 5, 2003, at 01:01 AM, Alan Leigh wrote:
Hi all,
Ok here is my problem.
I have a view (well a couple) which redraw stuff (how about that).
I have objects which draw themselves to these views.
This all works fine. The problem is when the preferences change (I am
after the instant change, i.e. no 'Ok' button :) )...
When they change I send out a 'redrawOptionsChanged' notification,
which both the redraw view and the objects drawing themselves listen
for. I don't know how I can make a refresh happen at the right time.
If the view and the objects both hear the notification, the objects
don't have time to update to the new settings before the redrawView
tells them all to refresh. So basically you change an option, the view
stays the same but if I minimise the window then reopen it, all is
well.
So my next idea was that all the objects listen for new prefs, the
view doesn't. Then the objects fire off a notification saying "we need
to be redrawn" and then the view listens to that. The problem is that
there is more than one object, so the view ends up redrawing itself
once for each object.
What is the right way to handle this? No doubt there is an obvious
solution.....
I decided against having the objects call [NSUserDefaults
standardDefaults] (this is where all my drawings prefs etc are stored)
every time they drew themselves, as I read this was slow (they only
call this when they need to update themselves, so when they get a
notification)..... although it is seeming mighty attractive right
now....
Or maybe a second notification? So...
'redrawOptionsChanged' <- Objects and view listen for this
'refreshIfNeeded' <- View listens for this
??? Any hints / comments?
Cheers,
Alan
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.