• 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: Newbie Question: Controls not redrawing on changes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Newbie Question: Controls not redrawing on changes


  • Subject: Re: Newbie Question: Controls not redrawing on changes
  • From: Christopher Kempke <email@hidden>
  • Date: Sun, 4 May 2008 15:23:43 -0700

Thanks to those folks who have tried (unsuccessfully) to help me. My first post clearly contained too many magenta mackerels, so I've done what I should have started with and reduced it to a shorter example.

Given the following complete, nibless, and astoundingly uninteresting app:

#import <Cocoa/Cocoa.h>

int main(int argc, char *argv[])
{
//    return NSApplicationMain(argc,  (const char **) argv);
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
[NSApplication sharedApplication];

NSRect platRect;
platRect.origin.x = 300;
platRect.origin.y = 300;
platRect.size.width = 200;
platRect.size.height = 200;

NSWindow* aWindow = [[NSWindow alloc] initWithContentRect:platRect
styleMask:(NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask) backing:NSBackingStoreRetained defer:YES];



platRect.origin.x = 20; platRect.origin.y = 20; platRect.size.width = 100; platRect.size.height = 100;

NSControl* ctl = [[NSButton alloc] init];
[(NSButton*)ctl setButtonType:NSSwitchButton];
[(NSButton*)ctl setTitle:@"Check Me"];
[(NSButton*)ctl setState:1];
[ctl setFrame:platRect];

NSView* cview = [aWindow contentView];
[cview addSubview:ctl];

[aWindow makeKeyAndOrderFront:nil];

[NSApp run];

return 0;
}

Clearly I'm missing something critical here (and "artistic talent" isn't what I'm looking for). What important step am I missing to make the event loop handle the drawing of my window and checkbox?

--Christopher Kempke
_______________________________________________

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


  • Follow-Ups:
    • Re: Newbie Question: Controls not redrawing on changes
      • From: Adam Leonard <email@hidden>
  • Prev by Date: Re: Reading XML (Mr. Gecko)
  • Next by Date: Cannot remove an observer ... because it is not registered as an observer.
  • Previous by thread: Re: Reading XML (Mr. Gecko)
  • Next by thread: Re: Newbie Question: Controls not redrawing on changes
  • Index(es):
    • Date
    • Thread