Re: Temporarily disabling notifications?
Re: Temporarily disabling notifications?
- Subject: Re: Temporarily disabling notifications?
- From: Ondra Cada <email@hidden>
- Date: Tue, 7 Jun 2005 02:43:30 +0200
Joshua,
On 7.6.2005, at 2:03, Joshua Scott Emmons wrote:
The problem is that setFrameOrigin: fires the same notification as
setFrame: (NSViewFrameDidChangeNotification). Therefore whenever I
move the subview the whole process starts over again. Would the
proper thing to do be to remove notifications while I'm in my
rearrange method and register for them again at the end of it? Or
am I missing an obvious pattern that addresses this?
static BOOL doRearrange=YES;
-(void)subviewFrameResized:(NSNotification *)notification{
if (doRearrange) [self rearrange];
}
-(void)rearrange{
doRearrange=YES;
[mySubview setFrameOrigin:NSMakePoint(x,y)];
doRearrange=NO;
}
Actually, there can be a better solution in this particular case, but
this one is generic enough (well, perhaps instead of a static you may
want to use a property, so that more views do not clash).
---
Ondra Čada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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