• 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: Setting NSTextField inside drawRect:
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Setting NSTextField inside drawRect:


  • Subject: Re: Setting NSTextField inside drawRect:
  • From: Jerry Krinock <email@hidden>
  • Date: Sun, 17 Feb 2008 18:34:21 -0800


On 2008 Feb, 16, at 0:01, Gerriet M. Denkmann wrote:

I have in 10.4.11 an NSWindow with a MyView and an NSTextField.

- (void)drawRect:(NSRect)rect
{
[ [ NSColor redColor ] set ];
NSRectFill( rect );
[ textField setStringValue: @"Buh" ];

// without the following line, the textField will never show its new text:
[ self performSelector: @selector(textFieldUpdate) withObject: nil afterDelay: 0.0 ];
}


- (void)textFieldUpdate { [ textField setNeedsDisplay: YES ]; }

Why does setting an NSTextField form inside drawRect: not work?

I can't say for sure, because you did not explain which class implementation the above code was copied from. But a possible explanation is that your drawRect: method is not drawing your textField. When you implement drawRect:, you're the man! The system assumes that drawRect: is going to draw ^everything^ in the rect argument that it is given.
_______________________________________________


Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Setting NSTextField inside drawRect: (From: "Gerriet M. Denkmann" <email@hidden>)

  • Prev by Date: re: CoreData Performance Mystery
  • Next by Date: Re: Where to enforce paragraph-cohesion policy in text system?
  • Previous by thread: Setting NSTextField inside drawRect:
  • Next by thread: Re: Setting NSTextField inside drawRect:
  • Index(es):
    • Date
    • Thread