Re: IPhoto-Like Toolstrips
Re: IPhoto-Like Toolstrips
- Subject: Re: IPhoto-Like Toolstrips
- From: John Pannell <email@hidden>
- Date: Thu, 3 Aug 2006 21:27:29 -0600
Hi Chris-
Don't know if this is your problem or not, but I had similar
artifacts from NSButton subviews in a control I have written. After
much troubles, I found that by marking the button's superview (the
control in my case, the view in yours) as dirty, the superview's
redraw got rid of the artifact.
In my button subclass, I did this in mouseEntered and mouseExited
(for rollover effects)
[[self superview] setNeedsDisplay:YES]
In the mouseDown, I had to get a little trickier, as the mouse down
caused a trip to the "event tracking" run loop mode...
[[NSRunLoop currentRunLoop] performSelector:@selector(display) target:
[self superview] argument:nil order:1 modes:[NSArray
arrayWithObjects:@"NSEventTrackingRunLoopMode",
@"NSDefaultRunLoopMode", nil]];
As I said, this did successfully eliminate the artifacts for me,
hopefully it will work for you as well!
John
John Pannell
Positive Spin Media
http://www.positivespinmedia.com
On Aug 3, 2006, at 5:53 PM, Chris Blunt wrote:
Hi,
(Apologies for cross-post)
I'm trying to create a button strip / toolbar like that use in the
latest iPhoto versions (underneath the photos) for my app. A little
research has hinted that overriding the NSToolbar would be unsuitable.
I have opted to create an NSView and attach a series of custom
NSButton classes to that view. All is working, except that when
clicked, the button draws a thick grey line along its bottom edge
that also stays drawn when the button is released.
I have set the border and bezel types to (what I think) are 'do
nothing', but can't seem to get rid of this line. Could anyone
point out where I'm going wrong?
Code for my custom button is:
------------------------------------
// MyToolstripButton.m
//
- (id)initWithFrame:(NSRect)frameRect
{
if( self = [super initWithFrame:frameRect] )
{
[self setBordered:NO];
[self setImagePosition:NSImageAbove];
// Setup the strip button's action cell
[[self cell] setBezelStyle:NSShadowlessSquareBezelStyle];
[[self cell] setHighlightsBy:NSNoCellMask];
[[self cell] setFont:[NSFont systemFontOfSize:10.0]];
}
return self;
}
//
// Method to create a MyToolstripButton and attach it to given NSView
- (MyToolstripButton *)toolstripButtonInView:(NSView *)aView
frame:(NSRect)aFrame
state:(BOOL)state
continuous:(BOOL)continuous
image:(NSImage *)image
title:(NSString *)title
{
MyToolstripButton *button = [[MyToolstripButton alloc] aFrame];
// Setup the button
[button setContinuous:continuous];
[button setState:state];
[button setImage:image];
[button setTitle:title];
// Add stripbutton to view
[aView addSubview:button];
[button release];
// Return the newly created button
return button;
}
------------------------------------
Thanks,
Chris
--
www.chrisblunt.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40positivespinmedia.com
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