• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Resizing NSButton doesn't clear previous size
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


References: 
 >Resizing NSButton doesn't clear previous size (From: "Frederick C. Lee" <email@hidden>)

  • Prev by Date: Bindings NSTableView Refresh
  • Next by Date: Bundle loading question
  • Previous by thread: Re: Resizing NSButton doesn't clear previous size
  • Next by thread: Threading and instance data (copying)
  • Index(es):
    • Date
    • Thread