Hi,

I'm using NSScrollers directly, e.g. not in an NSScrollView. Using 10.6.3 
(haven't checked anything else mind you) I'm seeing some strange behaviour when 
I try and resize them. I have code similar to the autosizing stuff in Cocoa/IB 
which, for example, resizes controls as a window resizes. I noticed that 
NSScrollers didn't seem to be resizing properly and were falling behind the 
size they should be. This is the function I use to set the width of a control:

void UCMacControlImp::SetWidth( const SInt32 theWidth )
{
        NSRect frame = [m_nativeControl frame];
        
        [[m_nativeControl superview] setNeedsDisplayInRect:[m_nativeControl 
frame]];
        
        frame.size.width = floor( ( CGFloat )theWidth );
        [m_nativeControl setFrame:frame];
        [m_nativeControl setNeedsDisplay:YES];
        
        return;
}

What I noticed in the debugger was that the frame of the NSScroller 
occasionally wasn't changing to what I set it to. For example if theWidth was 
586 and the frame width at the time SetWidth() is called is 585 then after the 
setFrame: message the width of the frame would still be 585, not 586. This 
doesn't happen all the time, just occasionally, but it's enough for the width 
to get out of sync with what it should be. When the correct thing does happen I 
see the values update as expected in the debugger.

In my test app I have an NSButton in the same window but that stays perfectly 
in sync as it's resized. I also haven't noticed problems with any other views, 
which I use plenty of, it just seems to be NSScrollers. The problem occurs in 
both 32 and 64 bit builds.

Originally I was using setFrameSize: but that also had problems.

Does anyone have any ideas about what might be going on?

Regards,

Jo Meder

_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to