• 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
CheckBoxes in the vertical NSRulerView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CheckBoxes in the vertical NSRulerView


  • Subject: CheckBoxes in the vertical NSRulerView
  • From: Lorenzo <email@hidden>
  • Date: Sun, 24 Oct 2004 21:35:02 +0200

Hi list,
I have put several checkBoxes into a vertical NSRulerView, but when I scroll
the scrollerView vertically I see the checkBoxes moving like crazy up and
down, and the refresh doesn't work properly. What did I do wrong?
Or, is it an Apple's bug?


I subclassed and created my MYRulerView then I call
-------------------------------------
[NSScrollView setRulerViewClass:[MYRulerView class]];
[scrollView setHasHorizontalRuler:YES];
[scrollView setHasVerticalRuler:YES];
[scrollView setRulersVisible:YES];

//...

vRuler = [scrollView verticalRulerView];
[vRuler setClientView:myView];
[vRuler setRuleThickness:60];


Then I added several check-boxes to the vertical ruler
-------------------------------------
NSRect aFrame = NSMakeRect(5, (totCh * kChHeight), 40, kChHeight);
NSButton *aCheckBox = [[NSButton alloc] initWithFrame:aFrame];
[aCheckBox setButtonType:NSSwitchButton];
[[aCheckBox cell] setControlSize:NSMiniControlSize];
[vRuler addSubview:aCheckBox];
totCh++;


Now I can see the check-boxes in the vertical ruler. They look at the right
place and everything seems ok. But, if I scroll the view, the checkBoxes are
not properly refreshed. Here's my MYRulerView class:
-------------------------------------
- (void)drawHashMarksAndLabelsInRect:(NSRect)rect
{
// in the horizontal ruler I draw the hashMarks and labels
if(self == hRuler){
[super drawHashMarksAndLabelsInRect:rect];
}

// in the vertical ruler I don't draw the hashMarks and labels
}


- (void)drawMarkersInRect:(NSRect)rect
{
if(self == hRuler){
[super drawMarkersInRect:rect];
}
}


-------------------------------------
I also tried to play with setAutoresizingMask and setAutoresizesSubviews,
usuccessfully. It seems that the verticalRulerView changes its frame or its
bounds or its originOffset arbitrarly when scrolling, but even this is not
true. I have checked that and the bounds and the frame and the originOffset
remain the same when scrolling. In facts, when I click on the view the first
checkBox appears at the top of the verticalRuler, no matter if I scroll the
view totally down. What did I do wrong?
Or is it an Apple's bug?


Best Regards
--
Lorenzo
email: email@hidden

> From: Clark Cox <email@hidden>
> Reply-To: Clark Cox <email@hidden>
> Date: Wed, 20 Oct 2004 12:49:03 -0400
> To: Lorenzo <email@hidden>
> Cc: email@hidden
> Subject: Re: Left Fixed Header in a Scrolling View
>
> On Wed, 20 Oct 2004 16:37:30 +0200, Lorenzo <email@hidden> wrote:
>> Hi here,
>> I would like to create a scrolling view like the iMovie "time/clips"
>> editor". Since in iMovie the channels are 3 and fixed (1 for clips + 2
>> songs) the check-boxes activating the sound of the channels are out of the
>> scrolling view. It works.
>> Instead in my application, since the number of channels (row) is variable, I
>> need to include the check-boxes within the scrolling view, in a fixed "left
>> header". This "left header" has not to scroll horizontally. It has to scroll
>> vertically only. And more, the horizontal ruler should appear only on the
>> mobile part of the view.
>>
>> Which approach do you suggest?
>> Should I create two scrolling views and join them by the vertical scrolling
>> value?
>
> You could probably create your own custom NSRulerView subclass to add
> to the NSScrollView. In the vertical ruler, you would put your
> checkboxes, and in the horizontal ruler, you would draw your normal
> ruler.
>
> --
> Clark S. Cox III
> email@hidden
> http://www.livejournal.com/users/clarkcox3/
> http://homepage.mac.com/clarkcox3/

_______________________________________________
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

References: 
 >Re: Left Fixed Header in a Scrolling View (From: Clark Cox <email@hidden>)

  • Prev by Date: Menubar inside window
  • Next by Date: Re: WebView Auto-Load
  • Previous by thread: Re: Left Fixed Header in a Scrolling View
  • Next by thread: [newbie] Create app as a startup item
  • Index(es):
    • Date
    • Thread