Transparent divider

  • I set my NSSplitView dividerThickness to 1.0;
    But it is too small to pick it and drag it to resize the NSSplitView.
    Anyway, 2.0 is too large to display. It has not a nice look.
    So I thought to set the dividerThickness to 2.0 and to draw it with a
    vertical transparent line (width 2.0). But it doesn't work as expected.
    I see a black vertical line even with isOpaque is NO.
    Is a way to draw it as transparent?

    - (void)drawDividerInRect:(NSRect)aRect
    {
        [[NSColor clearColor] set];
        NSRectFill(lineRect);
    }

    - (float)dividerThickness
    {
        return 2.0;
    }

    - (BOOL)isOpaque
    {
        return NO;
    }

    Best Regards
    --
    Lorenzo
    email: <archidea...>
  • > I see a black vertical line even with isOpaque is NO.
    > Is a way to draw it as transparent?
    >
    > - (void)drawDividerInRect:(NSRect)aRect
    > {
    > [[NSColor clearColor] set];
    > NSRectFill(lineRect);
    > }

    NSRectFill(x) is the same as NSRectFillUsingOperation(x,
    NSCompositeCopy), which won’t use the alpha data. You should be using
    the NSCompositeSourceOver compositing operation instead.

    -Ben
previous month november 2007 next month
MTWTFSS
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30    
Go to today