• 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: How do I get access to the control within a NSToolbarItem?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How do I get access to the control within a NSToolbarItem?


  • Subject: Re: How do I get access to the control within a NSToolbarItem?
  • From: Daryle Walker <email@hidden>
  • Date: Sun, 03 Aug 2014 14:56:50 -0400

On Aug 3, 2014, at 2:19 PM, Kyle Sluder <email@hidden> wrote:

> On Aug 3, 2014, at 11:11 AM, Daryle Walker <email@hidden> wrote:
>>
>> I’m adding a combined Back/Forward toolbar button to my web browser project.  I was going to enable/disable each button half like:
>>
>> - (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame
>> {
>>   // Ignore notices from sub-frames
>>   if ((self.webView == sender) && (frame == [sender mainFrame])) {
>>       [self.toolbarBackForward setEnabled:[sender canGoBack] forSegment:kPrGoBackSegment];
>>       [self.toolbarBackForward setEnabled:[sender canGoForward] forSegment:kPrGoForwardSegment];
>>   }
>> }
>>
>> But I was getting problems with the method signatures being unrecognized.  Then I realized that the control I dragged from the XIB to the header file was a NSToolbarItem*, not the NSSegmentedControl* I was expecting.  How do I get to that inner control?  (Hopefully without wasting time making a subclass.)
>
> The `view` property of NSToolbarItem is pretty clearly documented.

I just noticed that myself.  Is “(NSSegmentedControl *)self.toolbarBackForward.view”, a cast to a (2 layers down) subclass, the way you’re supposed to access the control’s stuff?  It looks like a hack, but I’ll take it since it (seemingly) works.

—
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT mac DOT com

_______________________________________________

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: 
 >How do I get access to the control within a NSToolbarItem? (From: Daryle Walker <email@hidden>)
 >Re: How do I get access to the control within a NSToolbarItem? (From: Kyle Sluder <email@hidden>)

  • Prev by Date: Re: How do I get access to the control within a NSToolbarItem?
  • Next by Date: Re: How do I get access to the control within a NSToolbarItem?
  • Previous by thread: Re: How do I get access to the control within a NSToolbarItem?
  • Next by thread: Re: How do I get access to the control within a NSToolbarItem?
  • Index(es):
    • Date
    • Thread