On 09 Mar 2015, at 01:22, Patrick J. Collins <patr...@collinatorstudios.com> 
wrote:
>> Not sure why you'd waste time trying to bend unsuitable UI components to 
>> your will instead of building a custom view.
>> It's super easy and it always does exactly what you design it to do.
> 
> Well I guess I can ask the reverse question of, why does Apple waste
> their time creating and offering a "vertical line", if it's not useful?
> I mean, all I want is a vertical line.  I don't understand why something
> like that exists if it's not customizable.

 It’s not intended as a generic vertical line. The same control used to be 
called a “separator” in Carbon, which might make it more clear what this is 
intended for: It is a line that separates two groups of UI elements, just like 
NSBox. In fact, as you noticed, the view created when you drag a “vertical 
line” actually *is* just an NSBox in a special “draw a straight line” mode.

 But really, who cares if the view is 5pt wide as long as it draws the line 1px 
wide? In fact, it’s a good thing this view is 5pt wide, because if you’ve ever 
tried to hit a 1pt object with a mouse, you’ll have noticed that it is very 
hard to do. Which is exactly why the HIG has been recommending a minimum 8pt 
width for clickable objects. Look at the 1-line pane separators in Mail.app: 
They actually accept clicks several pixels to their left and right.

 Also, given NSBox has a “custom” drawing mode, have you tried just setting it 
to “Custom” using the respective NSBox methods on the view and set its line 
color?

 That said, are you sure you want to hard-code this to be a line? Usually one 
creates an image file containing the appearance of the image and then uses a 
layer or a layer-backed NSImageView to draw it. That way, if your graphics 
designer wants to give the line an emboss, or make it thicker, or give it a bit 
of shading, your code doesn’t need to change. Since you probably want to be 
able to drag it, you’d need a custom view to handle the tracking anyway, so I’d 
recommend a custom NSView. Make it layer-backed and set its layer’s contents to 
your image (setting the anchor so the image is centered in the view). That way, 
the GPU will take care of compositing the image, and won’t have to re-upload 
the entire window contents whenever the user drags, saving laptop users battery.

Cheers,
-- Uli Kusterer
“The Witnesses of TeachText are everywhere...”
http://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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to