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-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 be.

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

Re: Custom View in Toolbar

2010-03-08 Thread Kyle Sluder
On Mon, Mar 8, 2010 at 8:56 AM, David Blanton aired...@tularosa.net 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

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

Re: Custom View in Toolbar

2010-03-08 Thread Kyle Sluder
On Mon, Mar 8, 2010 at 10:58 AM, David Blanton aired...@tularosa.net 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

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

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 - (void)validate {

Re: Custom View in Toolbar

2010-03-08 Thread Kyle Sluder
On Mon, Mar 8, 2010 at 11:19 AM, David Blanton aired...@tularosa.net 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

Re: Custom View in Toolbar

2010-03-08 Thread Andy Lee
On Monday, March 08, 2010, at 11:56AM, David Blanton aired...@tularosa.net 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

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)

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

Re: Custom View in Toolbar

2010-03-08 Thread Graham Cox
an example of this in my app, where I put two text fields in a custom view in a toolbar item. Worked without a hitch as far as I recall, and reviewing the code I can't see that I needed to jump through any special hoops. They may be laughing at your inability (they sound like jerks

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 task

Custom View in Toolbar

2010-03-05 Thread David Blanton
Using IB I have placed a custom view in a window toolbar. The custom view contains buttons. The buttons are connected to actions. The custom view as a tool bar item auto validates. In IB the custom view and its contained buttons appears in the tool bar and customization palette

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

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 for all

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

Re: Custom View in Toolbar

2010-03-05 Thread Kyle Sluder
On Fri, Mar 5, 2010 at 10:45 AM, David Blanton aired...@tularosa.net 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

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