Re: Resizing NSButton doesn't clear previous size
Re: Resizing NSButton doesn't clear previous size
- Subject: Re: Resizing NSButton doesn't clear previous size
- From: Jeremy Dronfield <email@hidden>
- Date: Mon, 28 Jun 2004 09:53:03 +0100
On 28 Jun 2004, at 4:23 am, Frederick C. Lee wrote:
1) Create a NSButton object with a long title like: "Select Montreal".
2) Reset the title to a smaller string like: "Select Paris" per
following statements:
[selectCity_Button setTitle:buttonStr];
[selectCity_Button sizeToFit];
[selectCity_Button display];
3) View the new button. What you'll see is a piece of the previous
button that didn't get erased from the screen: "...eal"
The button won't redraw things that are outside its frame. Try
[selectCity_Button setTitle:buttonStr];
[selectCity_Button sizeToFit];
[[selectCity_Button superview] setNeedsDisplay:YES];
which will cause the superview and its subviews to be redrawn.
Regards,
-Jeremy
_______________________________________________
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.