objective c - How to disable the mouse hover expand effect on a NSTextView's NSScrollView scroller? -


i have nstextview , here's normal size of scroller:
enter image description here
, here's happens when hover scroller of textview:
enter image description here
however, don't want have 'expand' effect. how can remove it? i've tried search around on how perform this, couldn't find anything. want have regular scroller size (the thinner one) time, if user hovers it. possible?
thanks

i recommend subclassing nsscroller , override – drawarrow:highlight: / – drawknobslotinrect:highlight: / – drawknob methods have stable scroller appearance.

p.s. don't forget set new scroller class in xib-file scrollers.

update

here sample code:

- (void)drawknob {     // call default implementation overlay scrollers     if (self.scrollerstyle == nsscrollerstyleoverlay)     {         [super drawknob];         return;     }      if (_style == nsscrollerknobstylelight || _style == nsscrollerknobstyledefault)             [[nscolor colorwithcalibratedwhite:1.0 alpha:0.8] setfill];     else [[nscolor colorwithcalibratedwhite:0 alpha:0.4] setfill];      // note: can specify rect fixed width here     nsrect knobrect = [self rectforpart:nsscrollerknob];      // vertical scroller     nsinteger fullwidth = knobrect.size.width;     knobrect.size.width = round(knobrect.size.width/2);     knobrect.origin.x += (nsinteger)((fullwidth - knobrect.size.width)/2);      // draw...     nsbezierpath * thepath = [nsbezierpath bezierpath];      [thepath appendbezierpathwithroundedrect:knobrect xradius:4 yradius:4];     [thepath fill]; }  //---------------------------------------------------------------  - (void)drawknobslotinrect:(nsrect)slotrect highlight:(bool)flag {     // call default implementation overlay scrollers     // draw nothing usual     if (self.scrollerstyle == nsscrollerstyleoverlay)     {         [super drawknobslotinrect:slotrect highlight:flag];     } }  //---------------------------------------------------------------  - (void)drawarrow:(nsscrollerarrow)whicharrow highlight:(bool)flag {        // call default implementation overlay scrollers     // draw nothing usual     if (self.scrollerstyle == nsscrollerstyleoverlay)     {         [super drawarrow:whicharrow highlight:flag];     } } 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -