Re: Custom View in Toolbar

2010-03-09 Thread Gregory Weston
Paul Sanders wrote: > Gregory Weston wrote: > >> I just sat down and attempted to accomplish what you're describing. It took >> 15 minutes and well under a dozen lines of code. > > Care to share your code? As someone who develops on both Windows and Mac, I > know how hard the transition can b

Re: Custom View in Toolbar

2010-03-09 Thread Paul Sanders
Gregory Weston wrote: > I just sat down and attempted to accomplish what you're describing. It took > 15 minutes and well under a dozen lines of code. Care to share your code? As someone who develops on both Windows and Mac, I know how hard the transition can be. Paul Sanders. ___

Re: Custom View in Toolbar

2010-03-08 Thread Gregory Weston
David Blanton wrote: > So, it is not the workman it is the tool. Proven by how long it took > Apple to include toolbar support in IB and the fact that there is not > one answer or example anywhere on how to do what is supposed to be > trivial. Ergo, I stand by may statement that a trivial t

Re: Custom View in Toolbar

2010-03-08 Thread Graham Cox
On 06/03/2010, at 5:45 AM, David Blanton wrote: > Something that in MFC is trivial is near impossible with Cocoa. The Windows > guys here are laughing their ... off at my inability to accomplish a trivial > MFC task in a Cocoa equivalent. It's not "near impossible", it's straightforward. I've

Re: Custom View in Toolbar

2010-03-08 Thread Jon Pugh
At 9:56 AM -0700 3/8/10, David Blanton wrote: >So I ask again, how does one display a custom view containing controls in a >toolbar? Typically, all views are told to draw themselves via - [view setNeedsDisplay: YES] Jon ___ Cocoa-dev mailing list (Co

Re: Custom View in Toolbar

2010-03-08 Thread Richard Somers
On Mar 8, 2010, at 11:58 AM, David Blanton wrote: I sure would like to solve this problem. Check this thread out from about one year ago. It sounds similar to your problem. Subject: NSToolbarItem with custom view in Interface Builder 3 (Leopard) http://lists.apple.com/archive

Re: Custom View in Toolbar

2010-03-08 Thread Andy Lee
On Monday, March 08, 2010, at 11:56AM, "David Blanton" wrote: >>> So two hours later I still cannot display a custom view containing >>> buttons >>> in an NSToolbar. Something that in MFC is trivial is near >>> impossible with >>> Cocoa. The Windows guys here are laughing their ... off at my

Re: Custom View in Toolbar

2010-03-08 Thread Kyle Sluder
On Mon, Mar 8, 2010 at 11:19 AM, David Blanton wrote: > You did not look at what I provided. Yes, I did. But I got confused by your second screenshot and got it in my head that you had the view itself selected when you in fact had the toolbar item selected. So that was in fact my error. But my p

Re: Custom View in Toolbar

2010-03-08 Thread Quincey Morris
On Mar 8, 2010, at 10:58, David Blanton wrote: > When I build and run the view is not visible. So I read about validating > tool bar items: > > [snip] > > I have sub classed as suggested: > > @interface View : NSToolbarItem { > @public > > } > > @end > > > @implementation View > > - (voi

Re: Custom View in Toolbar

2010-03-08 Thread David Blanton
You did not look at what I provided. @interface View : NSToolbarItem { @public } @end @implementation View - (void)validate { [self setEnabled:YES]; } @end View is a subclass of NSToolbarItem. So validate is being called on the NSToolbarItem. I believe you have no clu

Re: Custom View in Toolbar

2010-03-08 Thread Kyle Sluder
On Mon, Mar 8, 2010 at 10:58 AM, David Blanton wrote: > @implementation View I would not recommend using this as the name for your NSView subclass, since ObjC lacks namespaces. I doubt there's still a View class hanging around anywhere, but it's safer to prefix it with some initialism of your own

Re: Custom View in Toolbar

2010-03-08 Thread David Blanton
Ok. Let me back up and repeat myself. I sure would like to solve this problem. Using IB I have added a Custom View from the Views & Cells Layout Views to the Allowed Toolbar Items palette. To this view I have added two Square Buttons from the Views & Cells Buttons selection. I then drag

Re: Custom View in Toolbar

2010-03-08 Thread Kyle Sluder
On Mon, Mar 8, 2010 at 8:56 AM, David Blanton wrote: > Apparently you do as the custom view containing two buttons placed in the > tool bar is not displayed. There is no reason to believe that the solution to your problem is to manually provoke -display. That's not how drawing works in AppKit. Yo

Re: Custom View in Toolbar

2010-03-08 Thread David Blanton
You never need to call anything to result in display. Apparently you do as the custom view containing two buttons placed in the tool bar is not displayed. The docs for -validate indicate that -setEnabled should be called if the custom view is a control and that NStoolbarItem has no idea on h

Re: Custom View in Toolbar

2010-03-05 Thread Chris Hanson
On Mar 5, 2010, at 1:53 PM, Kyle Sluder wrote: > You have a memory management bug somewhere, most likely in your > validation method. Turn on zombies, run in Instruments, and find out > where. If you’re using Xcode 3.2 or later, even before setting NSZombieEnabled and running in Instruments, you

Re: Custom View in Toolbar

2010-03-05 Thread Kyle Sluder
On Fri, Mar 5, 2010 at 10:45 AM, David Blanton wrote: > I have called every possible method on the view and the controls for them to > display.  Never see anything and in fact the second time through -validate > EXC_BAD_ACCESS is thrown. You never need to call anything to result in display. Your

Re: Custom View in Toolbar

2010-03-05 Thread Richard Somers
On Mar 5, 2010, at 11:45 AM, David Blanton wrote: So two hours later I still cannot display a custom view containing buttons in an NSToolbar. Something that in MFC is trivial is near impossible with Cocoa. The Windows guys here are laughing their ... off at my inability to accomplish a triv

Re: Custom View in Toolbar

2010-03-05 Thread Quincey Morris
On Mar 5, 2010, at 10:45, David Blanton wrote: > Well, I have read and re-read the docs on custom views in a toolbar. In > particular the section "View item validation". > > I sub-classed NSToolbarItem and set the custom view toolbar item to this > class. > > In this subclass I have outlets f

Re: Custom View in Toolbar

2010-03-05 Thread David Blanton
Well, I have read and re-read the docs on custom views in a toolbar. In particular the section "View item validation". I sub-classed NSToolbarItem and set the custom view toolbar item to this class. In this subclass I have outlets for all the controls in the view. I overrode -validate. I