CocoaDev

Edit AllPages

You want to change the ugly Black Line during dragging inside a table?

I do!

This is just a few hours playing, so please, if you find any errors write them down here. I am writing a code generator and this will be a part of it.

I know there is a problem when you use the commented out stuff. If you drag up or down then it looks like if the right color isn’t used when you pass over the row behind the selected row. Its not one of the used colors, its lighter. I hope you understands what I try to write.

This works for now in:

10.4.[678] <-= please add your system version here too. Of course when it works

10.3.[??]

So here’s the Category stuff.

#import <AppKit/NSBezierPath.h> #import <AppKit/NSTableView.h>

@interface NSTableView ( newDragLineOrder )

@end

@class NSBezierPath,NSTableView; @implementation NSTableView ( newDragLineOrder )

static float widthOffset = 8.0; // offSet where start drawing the line static float eyeDim = 6.0; // size of the circle

@end

Of course you can set color as you like. If you have Photoshop you can use the cmyk color settings from the color panel. 65% == 0.65 in NSColor

Like the finder there is a circle at the end, but you can make one at the beginning to. Looks nice.

Or with one column. http://static.flickr.com/101/273430255_eb918b4bae.jpg

#import <AppKit/NSBezierPath.h> #import <AppKit/NSTableView.h> #import <AppKit/NSTableColumn.h>

@interface NSTableView ( OneColumnDragLine )

@end

@class NSBezierPath, NSTableColumn; #define POINT_LEFT drawRect.origin.x+= ( widthOffset/2.0 + offsetLeftCol - eyeDim/2 ) #define POINT_RIGHT drawRect.size.width-= ( widthOffset + eyeDim ) #define POINT_HEIGHT (drawRect.size.height * fp12)

@implementation NSTableView ( OneColumnDragLine )

static float widthOffset = 8.0; // offSet where start drawing the line static float eyeDim = 6.0; // size of the circle

@end

** Bold means this can be important!! Its a Category for a NSTableView owned by Apple. If they change the call to this method inside then it could happen that or your app crashes or if Apple uses a new method name it uses Apples new method and will show things there way. **

At least I hope that they give us a public delegate method in 10.4.9 and later to override their standard method.

Of course you can also use this in your subclass if you like.

R