Re: NSTextView with top indent
Re: NSTextView with top indent
- Subject: Re: NSTextView with top indent
- From: Sam McCandlish <email@hidden>
- Date: Tue, 8 Jun 2004 18:38:58 -0400
Maybe you didnt use this for a reason, but did you see that on the
attributes pane of the Interface Builder inspector, there is a place
called "text border"? There are three boxes, one of which is a thin
black line.
Sam
On Jun 8, 2004, at 6:15 PM, Francisco Tolmasky wrote:
I'm trying to make a simple one-line text view with a black border
around it. Things are working fine, except for the fact that it
doesn't look so good since the text highlight touches the top border.
So I decided I would just add a little margin around it of 1.0 pixel to
give it a little space. To do this, I used setContainerInset: with an
NSSize of (1.0,1.0). This did push it in 1.0 pixels, BUT
unfortunately, it destroys my black border for some reason. To create
my black border I just do this:
- (void)drawRect:(NSRect)aRect
{
NSRect bounds= [self bounds];
[super drawRect: aRect];
[NSBezierPath strokeLineFromPoint:
NSMakePoint(NSMinX(bounds)+0.5,NSMinY(bounds)) toPoint:
NSMakePoint(NSMinX(bounds)+0.5,NSMaxY(bounds))];
[NSBezierPath strokeLineFromPoint: NSMakePoint(NSMaxX(bounds)-0.5,0.0)
toPoint: NSMakePoint(NSMaxX(bounds)-0.5,NSMaxY(bounds))];
[NSBezierPath strokeLineFromPoint:
NSMakePoint(NSMinX(bounds),NSMinY(bounds)+0.5) toPoint:
NSMakePoint(NSMaxX(bounds),NSMinY(bounds)+0.5)];
[NSBezierPath strokeLineFromPoint:
NSMakePoint(NSMinX(bounds),NSMaxY(bounds)-0.5) toPoint:
NSMakePoint(NSMaxX(bounds),NSMaxY(bounds)-0.5)];
}
For some reason however, adding an inset draws a white line on top of
my top border, thus making only 3/4 of the border show up. The border
drawing MUST be here (it can't be in a surrounding text view) for my
program. Does anyone know how to get around this, or another method of
adding a top margin?
Thank you,
Francisco Tolmasky
email@hidden
http://www-scf.usc.edu/~tolmasky/
_______________________________________________
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.