Re: NSView and backgrounds, selectable
Re: NSView and backgrounds, selectable
- Subject: Re: NSView and backgrounds, selectable
- From: Yann Bizeul <email@hidden>
- Date: Tue, 4 May 2004 13:57:57 +0200
>
I was wondering if there was a way to set NSView's background to a
>
different color,
>
I know that NSTableView wrapped in a ScrollView, has this capability.
You can try to draw things in drawRect: method, like this (from memory)
-(void)drawRect:(NSRect)aRect
{
NSBezierPath *surface = [ NSBezierPath bezierPathWithRect: [ self
bounds ]];
[[ NSColor redColor ] set ];
[ surface fill ];
[ super drawRect: aRect ];
}
>
And also what is the way to make a NSView Selectable?
Catch mouseDown events (see NSResponder documentation) and change the
color, or contour like above
>
Here is my scenario, I have a NSSplitView that is a subview of a
>
NSScrollView, And I am adding custom NSSplitViews to that NSPlitView,
>
So I want the added NSSplitViews to be able to be selectable and have
>
a different color of background.
>
Any way to set the NSScrollView's color and make them selectable?
Let me re-formulate :
You have a NSScrollView, that contains a NSSplitView, with multiple
NSView's inside ? And you want them to be selectable ?
Am I right ?
I would try to subclass NSSplitView to add an instance variable holding
the current selection.
This way, each subview would be able to send a [[ self superview ]
setSelection: self ]; so that your NSSplitView would be able to notify
the old selection to return to a normal background.
If somebody has a better idea... :-)
--
Yann Bizeul - yann at tynsoe.org
http://projects.tynsoe.org/
_______________________________________________
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.