• 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: NSButtonCell subclass (partially transparent images)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSButtonCell subclass (partially transparent images)


  • Subject: Re: NSButtonCell subclass (partially transparent images)
  • From: Darrin Filer <email@hidden>
  • Date: Fri, 8 Feb 2002 22:55:59 -0500

Thanks for the assistance but I'm still at an impass and about to rewrite NSButton's functionality from scratch. Seems like buttons with semi-transparent images would be something that cocoa would support. However, most people who have replied to my various posts have indicated that they subclassed NSView eventually to solve the problems.

In the quoted block of code the debugger provides the following info:
cellFrame.origin is always {0,0}
[self image] is loaded and its dimensions match that of the loaded file
controlView is indeed the NSButton which contains the cell

There is no other code that draws into the view. The button is not transparent. It responds to mouse clicks in the properly. Thus, the contol's view is in the right location and of the correct size.

Am I missing something obvious here or can button cells simply not draw into their control views properly?

darrin filer


On Friday, February 8, 2002, at 09:53 PM, Erik M. Buck wrote:

I have annotated your code:

- (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView
*)controlView {
[controlView lockFocus]; // NOT NEEDED
[[self image] compositeToPoint:cellFrame.origin
operation:NSCompositeCopy];
[controlView unlockFocus]; // NOT NEEDED
[controlView setNeedsDisplay:YES]; // NOT NEEDED
}

Assuming that [self image] is properly loaded, why would this code not
draw anything?

if [self image] returns non-nil and cellFrame.origin is in the visible
portion of controlView and drawInteriorWithFrame:inView: is actually being
called then it should draw the image.

See http://www.stepwise.com/Articles/Technical/NSCell.html
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: NSButtonCell subclass (partially transparent images)
      • From: "Erik M. Buck" <email@hidden>
References: 
 >Re: NSButtonCell subclass (partially transparent images) (From: "Erik M. Buck" <email@hidden>)

  • Prev by Date: Overiding keyDown in an NSComboBox
  • Next by Date: Re: Why Cocoa source code isn't open? [terribly OT]
  • Previous by thread: Re: NSButtonCell subclass (partially transparent images)
  • Next by thread: Re: NSButtonCell subclass (partially transparent images)
  • Index(es):
    • Date
    • Thread