Re: NSToolbarItem view set to NSButton view, but not showing...

2014-04-23 Thread Peters, Brandon
I got it! The button code goes inside the validate() method, which one has to override for custom toolbar items with custom views/buttons. Everything works. Thanks for assistance everyone! On Apr 23, 2014, at 10:50 PM, Peters, Brandon mailto:bap...@my.fsu.edu>> wrote: “or if you were trying to

Re: NSToolbarItem view set to NSButton view, but not showing...

2014-04-23 Thread Peters, Brandon
“or if you were trying to plug in the button during init, which is too early).” That may be it, as I was setting the toolbar item’s view to the button in init(). If not there then where? On Apr 23, 2014, at 9:12 PM, Andy Lee mailto:ag...@mac.com>> wrote: Oh well, it was worth a try, and at le

Re: NSToolbarItem view set to NSButton view, but not showing...

2014-04-23 Thread Peters, Brandon
Andy, I discovered something that may lead to the real culprit. Using the debugger, I checked the size of the image chosen by imageNamed method, it was choosing the 128x128 icon image, but my toolbar item buttons were 48x48. I changed the toolbar item sizes to 32x32, same thing. On Apr 23, 201

Re: NSToolbarItem view set to NSButton view, but not showing...

2014-04-23 Thread Andy Lee
Oh well, it was worth a try, and at least you've confirmed some basic steps *are* working. From your previous message it sounds like you also checked self.toolbarItem and it too was not nil (as it could have been if, for example, you'd forgotten to connect an outlet in IB -- or if you were tryi

Re: NSToolbarItem view set to NSButton view, but not showing...

2014-04-23 Thread Peters, Brandon
Andy, I inserted code to check for nil images and image position, here is what I got: // set the original and alternate images...names are “opposite" NSImage *image = [NSImage imageNamed:@"StopButtonAlternateIcon”]; if(image) { NSLog(@"Setting 1st image for stop button"); [_button setImage

Re: NSToolbarItem view set to NSButton view, but not showing...

2014-04-23 Thread Peters, Brandon
Jerry, The example I was following comes from Stack Overflow and going something like this within the custom toolbar item: NSButton *button = [[NSButton alloc]init]; [button setImage:[NSImage imageNamed:@"StarEmpty"]]; [button setAlternateImage:[NSImage imageNamed:@"StarFull"]]; [button setImage

Re: NSToolbarItem view set to NSButton view, but not showing...

2014-04-23 Thread Andy Lee
On Apr 23, 2014, at 6:36 PM, Jerry Krinock wrote: > > On 2014 Apr 23, at 15:13, Peters, Brandon wrote: > >> call [toolbaritem setView:view] and pass in the NSButton. > > Try some bonehead debugging with NSLog(). Verify that toolbaritem is your > target item at that point, in particular, th

Re: NSToolbarItem view set to NSButton view, but not showing...

2014-04-23 Thread Eric Shepherd
There's a lot to be said for spreading lots of NSLog through your code. It's amazing how many bugs you can nail down using this old-school form of debugging. Eric Shepherd > On Apr 23, 2014, at 6:36 PM, Jerry Krinock wrote: > > Try some bonehead debugging with NSLog(). Verify that toolbaritem

Re: NSToolbarItem view set to NSButton view, but not showing...

2014-04-23 Thread Jerry Krinock
On 2014 Apr 23, at 15:13, Peters, Brandon wrote: > call [toolbaritem setView:view] and pass in the NSButton. Try some bonehead debugging with NSLog(). Verify that toolbaritem is your target item at that point, in particular, that it is not nil. If that seems to be OK, try some more advanced

NSToolbarItem view set to NSButton view, but not showing...

2014-04-23 Thread Peters, Brandon
Devs, I have a custom NSToolbarItem with a NSButton underneath. I set the main and alternate images for the button using [NSImage imageNamed:imageName], then call [toolbaritem setView:view] and pass in the NSButton. But when I run the application, the NSToolbarItem is does not show the image an