开发者

NSOpenGLView in NSSplitView

开发者 https://www.devze.com 2022-12-27 22:23 出处:网络
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://devel

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/GLChildW开发者_开发技巧indowDemo/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?


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();
0

精彩评论

暂无评论...
验证码 换一张
取 消