views:

86

answers:

1

When i put an NSOpenglView in NSSplitView, a problem occurs while dragging splitter. The openGLView and SplitView are resizing asynchronously. i found a solution in apple mail list thread http://developer.apple.com/mac/library/samplecode/GLChildWindowDemo/Introduction/Intro.html

and i found a solution with some carbon calls. but now i get link error (only in release mode).

so i'v got two questions - is there any cocoa way to fix the splitter - gl problem? if no - how can i fix carbon linker errors in release mode?

A: 

I found the answer.

the right way is to implement thees methods in your MYWindow : NSWindow

BOOL needsEnableUpdate;

-(void)disableUpdatesUntilFlush
{
    if(!needsEnableUpdate)
        NSDisableScreenUpdates();
    needsEnableUpdate = YES;
}

-(void)flushWindow
{
    [super flushWindow];
    if(needsEnableUpdate)
    {
        needsEnableUpdate = NO;
        NSEnableScreenUpdates();
    }
}

and in NSSplitterView delegate implement

#pragma mark NSSplitView Delegate
-(void)splitViewWillResizeSubviews:(NSNotification *)notification
{
    [window disableUpdatesUntilFlush];
}

my problem was that i tried to use carbon calls:

DisableScreenUpdates();
EnableScreenUpdates();

instead of cocoa ones:

NSDisableScreenUpdates();
NSEnableScreenUpdates();
Remizorrr