Re: moving popup buttons programmatically
Re: moving popup buttons programmatically
- Subject: Re: moving popup buttons programmatically
- From: Andy Lee <email@hidden>
- Date: Thu, 14 Mar 2002 11:35:38 -0500
At 9:54 AM -0500 3/14/02, RFM wrote:
>
Anyone seen this ? and is there a solution. I have a view that
>
contains some popops, the view's height may change given certain user
>
inputs, when this happens I want my popups to stay centered along the Y
>
axis. I DO NOT want to use the built in sizing mechanism. when I change
>
the frame origin of the popup, it reappears as jagged on the screen. Is
>
this a Cocoa bug ?
Sounds like this might be the answer (from the "Displaying After Moving or Resizing" section of the NSView doc):
- - - - -
None of the methods that alter an NSView's frame rectangle redisplays the NSView or marks it as needing display. When using the setFrame... methods, then, you must mark both the view being repositioned and its superview as needing display. This can be as simple as marking the superview in its entirety as needing display, or better, marking the superview in the old frame of the repositioned view and the view itself in its entirety. This code fragment sets theView's frame rectangle, and updates its superview appropriately:
NSView *theView; /* Assume this exists. */
NSRect newFrame; /* Assume this exists. */
[[theView superview] setNeedsDisplayInRect:[theView frame]];
[theView setFrame:newFrame];
[theView setNeedsDisplay:YES];
This sample marks the superview as needing display in the frame of the view about to be moved. Then, after theView is repositioned, it's marked as needing display in its entirety, which will nearly always be the case.
- - - - -
--Andy
_______________________________________________
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.