• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: background of NSButton and NSPopUpButton
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: background of NSButton and NSPopUpButton


  • Subject: Re: background of NSButton and NSPopUpButton
  • From: Michael Becker <email@hidden>
  • Date: Thu, 25 Nov 2004 15:25:15 +0100


Am 25.11.2004 um 13:32 schrieb Don Willems:

I did both!
I used a superview for the background image.
And I had to create subclasses of NSButton and NSPopUpButton for the thin lines between the buttons (to separate them).


I'm not completely satisfied with the result yet. It seems that the border-less NSPopUpButton draws the arrows right next to the far right of its frame, causing the separator line to be drawn in contact with the arrows. It needs some tweeking.

That is quickly done, just make the NSRect in which the cell is drawn smaller:


- (void)drawRect:(NSRect)cellFrame {
	// Draw the line
	[[ NSColor blackColor] set];
	NSRect frame = [self bounds];
	NSFrameRect( NSMakeRect(frame.size.width-1, 0, 1, frame.size.height) );

	// Draw the button
	NSRect innerFrame = cellFrame;
	innerFrame.size.width -= 5;
	[[ self cell] drawWithFrame:innerFrameFrame inView:self];
}

The biggest problem now is highlighting, if I click a button, the button background becomes white, not aqua blue.

Okay, I am not sure how to go about this. You could subclass NSButtonCell and play around with the -highlight:withFrame:inView: method. But I think it will not be very trivial to implement the typical aqua semi-transparent blue glow. Maybe you can work with exchanging the background image by a highlighted one?


Cheers,
Michael

_______________________________________________
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


  • Follow-Ups:
    • Re: background of NSButton and NSPopUpButton
      • From: Don Willems <email@hidden>
References: 
 >background of NSButton and NSPopUpButton (From: Don Willems <email@hidden>)
 >Re: background of NSButton and NSPopUpButton (From: Michael Becker <email@hidden>)
 >Re: background of NSButton and NSPopUpButton (From: Don Willems <email@hidden>)

  • Prev by Date: Re: What's wrong with this code?
  • Next by Date: NSImage and 8 bit
  • Previous by thread: Re: background of NSButton and NSPopUpButton
  • Next by thread: Re: background of NSButton and NSPopUpButton
  • Index(es):
    • Date
    • Thread