• 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
Re: Where To drawRect?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Where To drawRect?


  • Subject: Re: Where To drawRect?
  • From: Brian Smith <email@hidden>
  • Date: Tue, 18 May 2004 17:33:29 -0600

I would create a custom class of NSView which adds your NSTextView and a custom view which fills its bounds with your alpha color as subviews with the custom fill view ordered above all the other views. This custom view which uses the NSTextView and the fill view would then be the custom view for your scroll view. You may want to change your subclass of NSTextView to use the NSTextView and the fill view instead of inheriting from NSTextView. This is how I would approach the problem.


Regards,

Brian K Smith
President
SuaviWare Inc.
http://www.suaveware.com

On May 18, 2004, at 1:13 PM, J Nozzi wrote:

List:

I'm attempting to add a 'feature' (spelled 'sinful hack') to an NSTextView subclass of mine. I want to indicate the textview is uneditable with an alpha-faded gray (or user-selected color) custom view / NSBezierPath that covers the entire text of the textview.

The reason I'm using a custom view and not the textview's background color is because the bg and fg color are user-configurable for comfort while reading/editing.

I want users to see that it's very obviously an uneditable copy but still be able to select the text. I use the hitTest method to let clicks 'fall through' to the textview, but the problem arises when I begin to scroll. The custom view does not cover the entire text when scrolling and misbehaves (does not redraw) when you scroll back.

I've tried adding this view to various pieces of the whole textview / scrollview assembly, but nothing seems to work as expected. I *know* I'm missing the obvious somewhere - I'm really good at that.

So to what superview do I attach this custom view to have it cover the entire text, regardless of scrolling -- preferably efficiently (with no flicker during the scroll)?

- J
_______________________________________________
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.


References: 
 >Where To drawRect? (From: J Nozzi <email@hidden>)

  • Prev by Date: Textfield and s default button
  • Next by Date: Re: window rotation
  • Previous by thread: Where To drawRect?
  • Next by thread: Displaying Java Graphics in Cocoa UI?
  • Index(es):
    • Date
    • Thread