• 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: NSApplicationMain question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSApplicationMain question


  • Subject: Re: NSApplicationMain question
  • From: Bill Appleton <email@hidden>
  • Date: Sun, 25 Apr 2010 06:44:58 -0700

hi all,

i wanted to do a reality check on some of my code & ask some specific
questions.

1) how do i get that nifty application/preferences/services menu? i create
my menus dynamically (not nibs)

2) i need to create a raw NSScroller and control it like a NSSlider  (min,
max, value, proportion) is that possible?

3) are there window styles for palettes / document windows? there seems to
be only one style...

4) how do you guys check for memory leaks in the cocoa objects? when i
delete a menu... do i have to delete the individual items?

5) is my screen flipping code below going to work on multiple monitors?


thanks,

bill




void deletewindow(NSWindow *thewind)
{

    [thewind setReleasedWhenClosed:YES];
    [thewind close];
}

NSWindow *createwindow(rect *therect, long thestyle)
{
    NSWindow *thewind;
    NSRect myrect, newrect;

    myrect = [[NSScreen mainScreen] frame];
    newrect.origin.x = (*therect).left;
    newrect.origin.y = myrect.size.height - (*therect).bottom;
    newrect.size.width = (*therect).right - (*therect).left;
    newrect.size.height = (*therect).bottom - (*therect).top;
    thewind = [[NSWindow alloc] initWithContentRect:newrect
styleMask:thestyle backing:NSBackingStoreBuffered defer:YES];
    return(thewind);
}

NSMenu *newmenu(unsigned char *menuname)
{
    NSMenu *themenu;
    NSString *mystring;
    char tempstring[256];

    pstr2cstr(menuname, tempstring);
    mystring = [NSString stringWithUTF8String:tempstring];
    themenu = [[NSMenu alloc] initWithTitle:mystring];
    [themenu setAutoenablesItems:NO];
    [mystring release];
    return(themenu);
}

void deletemenu(NSMenu *themenu)
{

    [themenu release];
}

void setmenuitemtext(NSMenu *themenu, long itemindex, unsigned char
*itemname)
{
    NSString *mystring;
    NSMenuItem *theitem;
    char tempstring[256];

    itemindex --;
    pstr2cstr(itemname, tempstring);
    mystring = [NSString stringWithUTF8String:tempstring];
    theitem = [themenu itemAtIndex:itemindex];
    [theitem setTitle:mystring];
    [mystring release];
}
_______________________________________________

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: NSApplicationMain question
      • From: Charles Srstka <email@hidden>
    • Re: NSApplicationMain question
      • From: Keary Suska <email@hidden>
References: 
 >NSApplicationMain question (From: Bill Appleton <email@hidden>)
 >Re: NSApplicationMain question (From: Abhinay Kartik Reddyreddy <email@hidden>)
 >Re: NSApplicationMain question (From: Bill Appleton <email@hidden>)
 >Re: NSApplicationMain question (From: Shawn Erickson <email@hidden>)
 >Re: NSApplicationMain question (From: Bill Appleton <email@hidden>)
 >Re: NSApplicationMain question (From: Michael Ash <email@hidden>)
 >Re: NSApplicationMain question (From: Bill Appleton <email@hidden>)
 >Re: NSApplicationMain question (From: Jens Alfke <email@hidden>)
 >Re: NSApplicationMain question (From: Bill Appleton <email@hidden>)
 >Re: NSApplicationMain question (From: Jack Carbaugh <email@hidden>)

  • Prev by Date: Re: No icon in Dock's Application folder HUD?
  • Next by Date: Re: NSApplicationMain question
  • Previous by thread: Re: NSApplicationMain question
  • Next by thread: Re: NSApplicationMain question
  • Index(es):
    • Date
    • Thread