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: Andreas Mayer <email@hidden>
- Date: Mon, 28 Jun 2004 15:26:21 +0200
Am 28.06.2004 um 05:23 schrieb Frederick C. Lee:
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"
You are not supposed to call display directly. Use [selectCity_Button
setNeedsDisplay:YES] instead.
If that doesn't help, add this before your code above:
[[selectCity_Button superview] setNeedsDisplayInRect:[selectCity_Button
frame]];
(typed in Mail - beware of typos)
BTW: It's unusual for Cocoa code to use underscores in variable names.
http://developer.apple.com/documentation/Cocoa/Conceptual/
CodingGuidelines/index.html
"For names composed of multiple words, do not use punctuation marks as
parts of names or as separators (underscores, dashes, and so on);
instead, capitalize the first letter of each word and run the words
together."
Andreas
_______________________________________________
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.