Re: Buttons in NSScrollView
Re: Buttons in NSScrollView
- Subject: Re: Buttons in NSScrollView
- From: Damien Trog <email@hidden>
- Date: Tue, 15 Nov 2005 17:13:04 +0100
Thank you for your quick responses! Looks pretty easy :)
On 15 Nov 2005, at 17:02, Ryan Britton wrote:
You need to subclass NSScrollView and override the - tile method to
do this. Here's how I've done it in the past. Basically, you just
call super's version of the method, then adjust the subviews so you
can fit in your buttons. I create plusButton and minusButton in
this example in my - awakeFromNib method if they don't already
exist and add them as subviews to self.
- (void)tile
{
NSScroller *horizontalScroller;
NSRect frame;
[super tile];
horizontalScroller = [self horizontalScroller];
frame = [horizontalScroller frame];
if (plusButton) [plusButton setFrame:NSMakeRect(NSMinX(frame),
NSMinY(frame) - 1, BUTTON_WIDTH, BUTTON_HEIGHT)];
if (minusButton) [minusButton setFrame:NSMakeRect(NSMinX(frame) +
BUTTON_WIDTH, NSMinY(frame) - 1, BUTTON_WIDTH, BUTTON_HEIGHT)];
frame.origin.x += 2 * BUTTON_WIDTH;
frame.size.width -= 2 * BUTTON_WIDTH;
[horizontalScroller setFrame:frame];
}
On Nov 15, 2005, at 7:54 AM, Damien Trog wrote:
Hello people,
I've been looking around for a guide how to get some buttons in an
NSScrollView, like the tableviews in xcode in the datamodel editor
have (+ and - for adding attributes etc..). I did some googling
but couldn't find any guides on this.
Does anybody have a guide or sample code on how to do this? I
guess NSScroller needs to be subclassed in order to put some extra
buttons in like the two scroll buttons which are already there.
Thanks already.
Greetings,
Damien
_______________________________________________
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
_______________________________________________
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