Re: Custom NSToolbarItem
Re: Custom NSToolbarItem
- Subject: Re: Custom NSToolbarItem
- From: The Karl Adam <email@hidden>
- Date: Tue, 16 Nov 2004 23:52:20 -0500
target and action, you need both a target and valid action set on your
button. If your target doesn't respond to the action selector than it
won't be validated.
- Karl
On Tue, 16 Nov 2004 22:19:20 -0500, Colin O'Connor
<email@hidden> wrote:
> Great, thanks for the info. Everything is working fine now, except that my
> custom NSToolbarItem is grayed out, as if not enabled. I've tried using
> [toolbarItem setEnabled:YES], I tried implementing
> -(BOOL)validateToolbarItem:(NSToolbarItem *)theItem to just return YES, but
> to no avail.
>
> What am I missing?
>
>
>
>
> On 11/16/04 12:56 AM, "The Karl Adam" <email@hidden> wrote:
>
> > apple has example code that gives you the size of a toolbar, its a
> > method called toolbarHeightForWindow(), also if rememeber correctly
> > nothing in the toolbar can be higher than 32*32 unless you make your
> > own NSToolbarView.
> >
> > The code:
> > float toolbarHeightForWindow(NSWindow *window) {
> > NSToolbar *toolbar = [window toolbar];
> > float toolbarHeight = 0.0;
> > NSRect windowFrame;
> >
> > if(toolbar && [toolbar isVisible]) {
> > windowFrame = [NSWindow contentRectForFrameRect:[window frame]
> > styleMask:[window styleMask]];
> > toolbarHeight = NSHeight(windowFrame) - NSHeight([[window
> > contentView] frame]);
> > }
> >
> > return toolbarHeight;
> > }
> >
> >
> > On Mon, 15 Nov 2004 23:24:32 -0500, Colin O'Connor
> > <email@hidden> wrote:
> >> Okay, so far that has worked. Now, how should I go about more precisely
> >> positioning the buttons within the toolbar? I want them centered vertically?
> >> Also, is there any way to get the size of the toolbar? The NSToolbar class
> >> doesn't seem to contain any information about it's size or frame.
> >>
> >> Thanks again,
> >> Colin
> >>
> >>
> >>
> >>
> >> On 11/15/04 10:24 PM, "The Karl Adam" <email@hidden> wrote:
> >>
> >>> In order for this to work you need to init your view(button) with the
> >>> correct rect size dimension and make sure to set NSToolbarItem's
> >>> maxSize and minSIze so that the view has an area to draw into. Also
> >>> what you want is very possible as I have done it myself in an app I am
> >>> writing.
> >>>
> >>> -Karl
> >>>
> >>>
> >>> On Mon, 15 Nov 2004 21:22:17 -0500, Colin O'Connor
> >>> <email@hidden> wrote:
> >>>> I want to use an NSToolbar to switch views of my application (like is done
> >>>> in System Prefs, and many other apps), but I also want to include a couple
> >>>> NSButtons in the toolbar. My attempts to do so have been unsuccessful thus
> >>>> far.
> >>>>
> >>>> Is it possible to have an NSToolbar with both selectable items (like the
> >>>> standard Config, Save, etc.) and items that act as if they weren't in a
> >>>> toolbar (like the NSButton)? Is so, can you point me in the direction? I
> >>>> tried adding a button using setView: but that didn't work.
> >>>>
> >>>> Thanks,
> >>>> Colin
> >>>>
> >>>> _______________________________________________
> >>>> Do not post admin requests to the list. They will be ignored.
> >>>> Cocoa-dev mailing list (email@hidden)
> >>>> Help/Unsubscribe/Update your Subscription:
> >>>>
> >>>> This email sent to email@hidden
> >>>>
> >>>
> >>>
> >>
> >> _______________________________________________
> >>
> >>
> >> Do not post admin requests to the list. They will be ignored.
> >> Cocoa-dev mailing list (email@hidden)
> >> Help/Unsubscribe/Update your Subscription:
> >>
> >> This email sent to email@hidden
> >>
> >
> >
>
> _______________________________________________
>
>
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden