Re: How to fill rectangle under vertical scroller?
Hi Quincey, On Mon, Jun 22, 2009 at 2:33 PM, Quincey Morris wrote: > FWIW, the small "gotcha" in the sample code you linked to (AFAICT, since I > never tried it) is that it places the "placard" in the area normally > occupied by a scroll bar. The corner rect that the OP wants to draw is > slightly different, in that the NSScrollView deliberately draws white in > that corner, unless it's set to not draw a background at all. That means the > linked-to code may not be quite complete -- it may also be necessary to > ensure that the custom corner view draws above and/or after the scroll view, > or else it may get painted over. Subviews are always drawn after the parent (for obvious reasons if you think about it), so if I correctly understand the point you're trying to make, there won't be a problem. Regards, Chris ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to fill rectangle under vertical scroller?
On Jun 21, 2009, at 20:39, Graham Cox wrote: What I meant was to create a small view that is just the size of that small corner and use the -tile method to position it in the corner where you want it. This is what the sample code I pointed to is doing, albeit positioning a placard view in a different place. FWIW, the small "gotcha" in the sample code you linked to (AFAICT, since I never tried it) is that it places the "placard" in the area normally occupied by a scroll bar. The corner rect that the OP wants to draw is slightly different, in that the NSScrollView deliberately draws white in that corner, unless it's set to not draw a background at all. That means the linked-to code may not be quite complete -- it may also be necessary to ensure that the custom corner view draws above and/or after the scroll view, or else it may get painted over. I think that's what went wrong when the OP tried to follow this code pattern originally, although I don't think it's been confirmed. (Maybe the OP's recent silence means that it's all working now.) I did learn something marginally interesting from looking at the NSScrollView behavior in IB. If you set the background color to something other than white, it draws the clip view background in the specified color, but still draws the corner in white. I'm hopeful that piece of information may come in useful one of these years. :) ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to fill rectangle under vertical scroller?
On 21/06/2009, at 9:18 AM, Sumin Kim wrote: Hi, Graham, I think I finally got what you said. I referred your linked sample, and implemented my source as follows.(I enclose my source for anyone who has same problem with many thanks to this list.) I also needed to add some code to drawRect to draw my custom view correctly. If you find any problem from my source, please let me know. Well, this isn't what I meant. You've created a view that fills your entire scrollview, just to draw some background colour in the corner. What I meant was to create a small view that is just the size of that small corner and use the - tile method to position it in the corner where you want it. This is what the sample code I pointed to is doing, albeit positioning a placard view in a different place. Also, you are drawing the other's view's "content" in your scroll view. Instead, that view should be drawing its own content. This means you have to subclass NSView to make the corner view and implement its - drawRect method to draw whatever it is you want it to do. None of these things are difficult. I'm afraid your solution is incorrect. --Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to fill rectangle under vertical scroller?
Am 19.06.2009 um 04:23 schrieb Sumin Kim: the area under the vertical scroller and right to horizontal scroller still remains white. I tried to set different origin and frame size for the view that is supposed to be drawn the area, but the results have not changed. Where in the window is your table view? If it covers the lower right corner and your window is resizable, the white could be coming from the window's grow box view, not from your scroll view or table view. There seems to be some extra interaction where a table view leaves room for the grow box under a vertical scroller (if no horizontal scroller is there), and sets it to opaque as well. Cheers, -- Uli Kusterer "The Witnesses of TeachText are everywhere..." http://www.zathras.de ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to fill rectangle under vertical scroller?
> > >> > > You need to place a view here and do the custom drawing in the view. To > place the view, you need to subclass NSScrollView and override the -tile > method to place the view in that corner. The scrollview subclass will also > typically own the custom view. > > Here's an example from the archives that will do what you want: > > http://www.cocoabuilder.com/archive/message/cocoa/2001/6/29/21070 > > --Graham > > > Hi, Graham, I think I finally got what you said. I referred your linked sample, and implemented my source as follows.(I enclose my source for anyone who has same problem with many thanks to this list.) I also needed to add some code to drawRect to draw my custom view correctly. If you find any problem from my source, please let me know. #import "BSScrollView.h" @implementation BSScrollView // Prepare a view to be a background of scrollers. This view will cover all area of scrollView. - (void) _setScrollerBackgroundView:(NSView *) view{ [view retain]; [_scrollerBackgroundView release]; _scrollerBackgroundView = view; [self addSubview:_scrollerBackgroundView]; } - (NSView *) scrollerBackgroundView { return _scrollerBackgroundView; } - (void)tile { [super tile]; if (![self scrollerBackgroundView]) { // Place a view that cover all area of scroll view. NSRect tempRect = NSMakeRect(0.0, 0.0, [self bounds].size.width, [self bounds].size.height); NSView *tempView = [NSView allocWithZone:[self zone]]; [tempView initWithFrame:tempRect]; [self _setScrollerBackgroundView:tempView]; } } - (void)drawRect:(NSRect)rect { [super drawRect:rect]; // draw background color for scroll view. This color fills areas under knob slots and right bottom area of scroll view. [[NSColor blackColor]set]; NSRectFill([_scrollerBackgroundView frame]); } - (void) dealloc { [_scrollerBackgroundView release]; [super dealloc]; } @end ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to fill rectangle under vertical scroller?
On Jun 18, 2009, at 19:23, Sumin Kim wrote: Thanks for your information. I read your linked article, and tried to do the same thing. But, I am still in the problem. Where I want to draw a color is the area under vertical scroller but for the some reason, it seems that my new view is drawn at top of the vertical scroller. the area under the vertical scroller and right to horizontal scroller still remains white. I tried to set different origin and frame size for the view that is supposed to be drawn the area, but the results have not changed. I just want to change the color of this area. How can I? Did you try [scrollView setDrawsBackground: NO]? The area you want to draw is normally filled with white by the scroll view, and that's probably drawing over the top of your custom view. If you tell the scroll view not to draw its background, your view should show through. If it still doesn't show up, you'll need to actually debug your code. Is your view in the right place in the window? If so, is it hidden? If not, is it being drawn underneath something else? You'll need to look for an answer, instead of just coming back to this list and complaining that your code doesn't work. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to fill rectangle under vertical scroller?
> > > > You need to place a view here and do the custom drawing in the view. To > place the view, you need to subclass NSScrollView and override the -tile > method to place the view in that corner. The scrollview subclass will also > typically own the custom view. > > Here's an example from the archives that will do what you want: > > http://www.cocoabuilder.com/archive/message/cocoa/2001/6/29/21070 > > --Graham > > > Thanks for your information. I read your linked article, and tried to do the same thing. But, I am still in the problem. Where I want to draw a color is the area under vertical scroller but for the some reason, it seems that my new view is drawn at top of the vertical scroller. the area under the vertical scroller and right to horizontal scroller still remains white. I tried to set different origin and frame size for the view that is supposed to be drawn the area, but the results have not changed. I just want to change the color of this area. How can I? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to fill rectangle under vertical scroller?
Thanks for the information. Those frameworks seems very helpful for the future even though they are not solving my problem right now. Incidentally, I found out that I know the writer of HIMBIkAppKit personally. ;-) Thanks, On Thu, Jun 18, 2009 at 6:15 AM, Scott Andrew wrote: > Have you looked at a couple of frameworks that already do this? The two i > can think of fare. BWToolkit and HMBlkAppKit. Source is available for both. > > Scott > > ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to fill rectangle under vertical scroller?
On 16 Jun 2009, at 21:40, Sumin Kim wrote: That's not part of the scroller. Assuming you're working with NSTableView, this is the cornerView, which you can set up separately. Yes, you are right. I am working with table. Of course I tried to use cornerView. But as far as I understood with my experience dealing with cornerView, it was not I want to handle. I think the cornerView is the upper right corner of the tableView -I mean, above of the vertical scroller- but what I want to fill with my color is right bottom corner, under the vertical scroller. Am I understanding wrong? No, you're correct - I was mistaken about the purpose of cornerView. Carry on. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to fill rectangle under vertical scroller?
Have you looked at a couple of frameworks that already do this? The two i can think of fare. BWToolkit and HMBlkAppKit. Source is available for both. Scott On Jun 16, 2009, at 9:40 PM, Sumin Kim wrote: That's not part of the scroller. Assuming you're working with NSTableView, this is the cornerView, which you can set up separately. Yes, you are right. I am working with table. Of course I tried to use cornerView. But as far as I understood with my experience dealing with cornerView, it was not I want to handle. I think the cornerView is the upper right corner of the tableView -I mean, above of the vertical scroller- but what I want to fill with my color is right bottom corner, under the vertical scroller. Am I understanding wrong? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/scottandrew%40roadrunner.com This email sent to scottand...@roadrunner.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to fill rectangle under vertical scroller?
> > >> > That's not part of the scroller. Assuming you're working with NSTableView, > this is the cornerView, which you can set up separately. > Yes, you are right. I am working with table. Of course I tried to use cornerView. But as far as I understood with my experience dealing with cornerView, it was not I want to handle. I think the cornerView is the upper right corner of the tableView -I mean, above of the vertical scroller- but what I want to fill with my color is right bottom corner, under the vertical scroller. Am I understanding wrong? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to fill rectangle under vertical scroller?
On 16 Jun 2009, at 16:43, Sumin Kim wrote: I am drawing custom scroller for my application and could change color and looks of knob, arrows, and knob slot. But I still cannot change the color of a rectangle located in right bottom corner under vertical scroller. I could not find out how to handle the area. Any advice will be appreciated. That's not part of the scroller. Assuming you're working with NSTableView, this is the cornerView, which you can set up separately. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to fill rectangle under vertical scroller?
On 17/06/2009, at 9:43 AM, Sumin Kim wrote: I am drawing custom scroller for my application and could change color and looks of knob, arrows, and knob slot. But I still cannot change the color of a rectangle located in right bottom corner under vertical scroller. I could not find out how to handle the area. Any advice will be appreciated. You need to place a view here and do the custom drawing in the view. To place the view, you need to subclass NSScrollView and override the - tile method to place the view in that corner. The scrollview subclass will also typically own the custom view. Here's an example from the archives that will do what you want: http://www.cocoabuilder.com/archive/message/cocoa/2001/6/29/21070 --Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
How to fill rectangle under vertical scroller?
Hi, all. I am drawing custom scroller for my application and could change color and looks of knob, arrows, and knob slot. But I still cannot change the color of a rectangle located in right bottom corner under vertical scroller. I could not find out how to handle the area. Any advice will be appreciated. Thanks for your reading. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com