• 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
Can one rid of a control's border?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Can one rid of a control's border?


  • Subject: Can one rid of a control's border?
  • From: Ricky Sharp <email@hidden>
  • Date: Sat, 20 Nov 2004 16:12:23 -0600

In my custom button class, I cannot get rid of the 2-pixel border that its cell is inset by. This causes grief in when bringing up the size attributes in IB.

For troubleshooting purposes, I had my custom cell (derived from NSButtonCell) just paint its entire area with red. Here's the two drawing methods:

- (void)drawWithFrame:(NSRect)aFrame inView:(NSView*)aView
{
	[self drawInteriorWithFrame:aFrame inView:aView];
}

- (void)drawInteriorWithFrame:(NSRect)aFrame inView:(NSView*)aView
{
	[[NSColor redColor] set];
	NSRectFill (aFrame);
}

In IB, if I drag this custom button into a window, it places a 100 x 50 sized item (the default size I've set up). I can confirm this size by looking at a screenshot of the window in Photoshop.

When I bring up the size attributes, the width is reported as 96 and height is reported as 46. This makes some sense as I've read that a cell is typically inset by 2 pixels on all sides.

But this makes it difficult for me to type in pixel sizes; I always have to offset the width and height by values of 4.

Also, when dragging the custom buttons around the window in IB, only the cell's bounds will align up with the Aqua layout guides.

I know this doesn't happen with custom classes derived directly from NSView. FWIW, if my button class is derived from either NSControl or NSButton, these problems occur.

In my cell and button class, I've tried the following with no effect:

[theCell setBordered:NO]
[theCell setBezeled:NO]
[theCell setCellAttribute:NSCellIsBordered to:0];
[theCell setCellAttribute:NSCellIsInsetButton to:0];

[theButton setBordered:NO];


Can one rid of this border? Or is a cell always going to be inset by these 2 pixels?


___________________________________________________________
Ricky A. Sharp         mailto:email@hidden
Instant Interactive(tm)   http://www.instantinteractive.com

_______________________________________________
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


  • Prev by Date: Re: [NSMatrix putCell:] raising an exception
  • Next by Date: cocoa java bridge: converting nsarray to java array
  • Previous by thread: Re: check for Tab key pressed
  • Next by thread: cocoa java bridge: converting nsarray to java array
  • Index(es):
    • Date
    • Thread