Refresh problem with right aligned rectangle while resizing anNSOutlineView
-
Hello guys,
I would to place a simple round rectangle (as Mail.app unread badge) at the
right side of an NSOutlineView.
So this is the code I've used to get an NSBezierPath to draw (
http://developer.apple.com/samplecode/Reducer/listing21.html)
while this is the portions of code inside drawInRect event that draw it.
NSBezierPath *roundRect = [NSBezierPath bezierPathWithRoundedRect:
NSMakeRect(NSWidth(cellFrame)-20,inset.origin.y,20,20) cornerRadius: 4.0];
[controlView lockFocus];
[roundRect stroke];
[roundRect fill];
[controlView unlockFocus];
All works fine but when I try to resize the outlinew view the old rectangle
position still visible with the new one
(look here: http://img66.imageshack.us/img66/7857/picture4cf2.png)
the problem does not append if i try to put an NSImage using
compositeToPoint...
Why? Where the code is wrong?
Thanks -
Yes the highlight color has been replaced with my own. In fact I've used a
modified version of Source LIst (you can found it here:
http://web.mac.com/leemorgan/Bit_Bucket/Source_Code.html or
http://www.latenightsw.com/blog/?p=45) and I've added only the code I've
pasted before. I'm on leopard (if you want I can send a link to the complete
source).
On Nov 28, 2007 9:35 PM, Corbin Dunn <corbind...> wrote:
>
> On Nov 28, 2007, at 11:53 AM, malcom wrote:
>
>> Hello guys,
>> I would to place a simple round rectangle (as Mail.app unread badge)
>> at the
>> right side of an NSOutlineView.
>> So this is the code I've used to get an NSBezierPath to draw (
>> http://developer.apple.com/samplecode/Reducer/listing21.html)
>> while this is the portions of code inside drawInRect event that draw
>> it.
>>
>> NSBezierPath *roundRect = [NSBezierPath bezierPathWithRoundedRect:
>> NSMakeRect(NSWidth(cellFrame)-20,inset.origin.y,20,20) cornerRadius:
>> 4.0];
>> [controlView lockFocus];
>> [roundRect stroke];
>> [roundRect fill];
>> [controlView unlockFocus];
>>
>> All works fine but when I try to resize the outlinew view the old
>> rectangle
>> position still visible with the new one
>> (look here: http://img66.imageshack.us/img66/7857/picture4cf2.png)
>> the problem does not append if i try to put an NSImage using
>> compositeToPoint...
>> Why? Where the code is wrong?
>
> Live-resize caching may be conflicting with what you want to do.
> Ideally, it shouldn't, and you may have discovered a bug. Are you
> using Leopard, or are you hand rolling the source list highlighting
> style? Is it a full-width cell on Leopard? If it is Tiger, try
> overriding drawRect: in an NSTableView/NSOutlineView subclass, and
> simply call super; this will avoid live resize caching.
>
> corbin
>
>
--
Indie Mac Developer
web: www.malcom-mac.com
mail: <malcom.mac...>
aim: malcombsd -
On Nov 28, 2007, at 1:03 PM, malcom wrote:
> Yes the highlight color has been replaced with my own. In fact I've
> used a
> modified version of Source LIst (you can found it here:
> http://web.mac.com/leemorgan/Bit_Bucket/Source_Code.html or
> http://www.latenightsw.com/blog/?p=45) and I've added only the code
> I've
> pasted before. I'm on leopard (if you want I can send a link to the
> complete
> source).
Since you are on Leopard, use the built in source list highlighting
(assuming you are linking against 10.5).
http://developer.apple.com/releasenotes/Cocoa/AppKit.html
Read: NSTableView /NSOutlineView - selectionHighlightStyle.
corbin -
Hello Corbin,
I've tried to remove the highlightSelectionInClipRect and the hightlight
effect but nothing has changed so I'm not sure about the origin of this
refresh problem. This is the code, compile yourself and try to resize the
window itself (the rectangle is red, just a test).
http://www.box.net/shared/zqj5oqera5
On Nov 28, 2007 10:19 PM, Corbin Dunn <corbind...> wrote:
> On Nov 28, 2007, at 1:03 PM, malcom wrote:
>
>> Yes the highlight color has been replaced with my own. In fact I've
>> used a
>> modified version of Source LIst (you can found it here:
>> http://web.mac.com/leemorgan/Bit_Bucket/Source_Code.html or
>> http://www.latenightsw.com/blog/?p=45) and I've added only the code
>> I've
>> pasted before. I'm on leopard (if you want I can send a link to the
>> complete
>> source).
>
> Since you are on Leopard, use the built in source list highlighting
> (assuming you are linking against 10.5).
>
> http://developer.apple.com/releasenotes/Cocoa/AppKit.html
>
> Read: NSTableView /NSOutlineView - selectionHighlightStyle.
>
> corbin
>
--
Indie Mac Developer
web: www.malcom-mac.com
mail: <malcom.mac...>
aim: malcombsd


