• 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: Reaching the limits of 'learn by example'
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reaching the limits of 'learn by example'


  • Subject: Re: Reaching the limits of 'learn by example'
  • From: Stefan Arentz <email@hidden>
  • Date: Sun, 13 May 2001 23:14:27 +0200

On Sun, May 13, 2001 at 11:00:38PM +0200, Cyril Godefroy wrote:
> Hi all,
>
> thanks to the help and example applications etc available everywhere
> regarding Cocoa and Objective C, I'm just about to have my second app
> ready (my first Obj-C one though).
> But I don't know Objective-C, nor C. So any help regarding this little
> problem would be great:
>
> I'm creating a dockling to control sound level. I have the dockling
> appearing, the menu also, and I figured I could know on which level the
> user has clicked by setting for each level:
> [menuItem setRepresentedObject:tString];
> with tString being 0-6.
> When I try to get back the representedObject, nothing happens.
> NSString *level = [sender representedObject];
> What is worse, is I'm not able to print out the value that I get for
> level.I tried using NSLog, but it won't compile anymore if I add:
> NSLog (@"level is:%@",level)

Strange, that should compile. You did put a semicolon (;) at the end of
the line right? If so, what exactly is the compile time error?

> So:
> - how can I debug without using project builder (it won't let me launch
> a dockling which is only a bundle)?

I don't think you can, but NSLog() usually does the trick.

> - how can I be sure that I get the value the user clicked on back?

What you get back is the NSMenuItem that was selected. From the menu item
you request it's 'represented object' or tag value. Both should just work
so I think there's something wrong with the code that sets up the menu.

Maybe you can post the relevant code for your docket, I'm sure we can
find out what's causing this.

Stefan


  • Follow-Ups:
    • Re: Reaching the limits of 'learn by example'
      • From: Cyril Godefroy <email@hidden>
References: 
 >Reaching the limits of 'learn by example' (From: Cyril Godefroy <email@hidden>)

  • Prev by Date: Re: Type/Creator codes
  • Next by Date: Re: Reaching the limits of 'learn by example'
  • Previous by thread: Reaching the limits of 'learn by example'
  • Next by thread: Re: Reaching the limits of 'learn by example'
  • Index(es):
    • Date
    • Thread