On 23/11/2012, at 2:58 AM, Ross Carter <[email protected]> wrote:

> On Nov 21, 2012, at 8:22 PM, Graham Cox <[email protected]> wrote:
> 
>> The standard NSRulerMarker draws a black line in the client view as it is 
>> dragged. This comes 'for free' but I wonder how on earth it works. There is 
>> also no way to customise it that I can see. I'm wondering if this behaviour 
>> is interfering with view updates in my client view, but since it's not 
>> mentioned in the documentation I can only speculate. It seems to me 
>> NSRulerMarker is set up for its use in NSTextView and though the design 
>> seems to be fine for the more general case, in actual use the extra 
>> undocumented behaviours baked into it for use in a text view make it hard to 
>> use and not work as documented.
>> 
>> So, simple question: how can I keep an associated line in my client view 
>> moving as I drag a ruler marker?
> 
> So the line should appear only while the user is dragging the marker? Maybe 
> you should draw the line in a separate window rather than drawing in your 
> client view. Just a thought.


Yes, that's right. The design of the NSRulerViewDelegate protocol suggests that 
doing this is possible. In fact, the documentation explicitly states that the 
delegate method can be used for this purpose. However, it does not work, and 
the presence of an undocumented black line in its place suggests that maybe the 
standard NSRulerMarker is either putting a window over mine in the way you 
suggest, or it's doing some hackery that physically prevents my view from 
getting its updates as normal during dragging. Overlaying a whole separate 
window should not be necessary and it strikes me as a heavy-handed approach, 
though it may be a possible solution.

It looks as if I need to subclass NSRulerMarker and completely reimplement its 
tracking method to allow it to work exactly as documented, which is bloody 
annoying, because what really should have been done is that NSTextView should 
have subclassed NSRulerMarker for its special case, or NSRulerMarker should 
have more public override points so that the black line behaviour can be 
modified or suppressed. At the very least these weird behaviours for NSTextView 
should be documented.

--Graham



_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to