Forum breadcrumbs - You are here:WeLoveGod RallysPublic Forums: fbcocoaHelp using initWithWindowRef:
You need to log in to create posts and topics.
Help using initWithWindowRef:
1,678 Posts
#1 · November 1, 2010, 4:40 pm
Quote from Forum Archives on November 1, 2010, 4:40 pmPosted by: fblistserve <fblistserve@...>
I’m calling the following code in an attempt to print the contentView of a Carbon window. Two different windows ( i.e. different content and different WindowRefs ) but the same window attributes ( class is document window etc. ) produce the same result. Both windows are nibs. The WindowRef shows the correct window in the debugger as it enters the called function ( so the right window is being passed ) but the print of the contentView fails with an invalid window. Activating the pool makes no difference in the results that I can see.Any ideas for debugging( or corrections to my code ) or different methods for achieving the same result ( without using deprecated calls ) are very welcome.TIABrian SBeginCFunctionvoid PrintContentViewOfCarbonWindow( WindowRef carbonWindow ){//NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];NSWindow *cocoaWindow = [ [ [ NSWindow alloc ] initWithWindowRef:carbonWindow ] retain ];NSLog(@"%@",[cocoaWindow title]);[[cocoaWindow contentView] print:nil];//[pool release];[cocoaWindow release];}endC11/1/10 12:45:24 PM CCN X[2153] Calendar <<======= this is the NSLog call11/1/10 12:45:26 PM CCN X[2153] kCGErrorIllegalArgument: _CGSFindSharedWindow: WID 89611/1/10 12:45:26 PM CCN X[2153] kCGErrorIllegalArgument: CGSGetWindowTags: Invalid window 0x38011/1/10 12:45:26 PM [0x0-0xc70c7].com.brianstevens.ccnx[2153] Mon Nov 1 12:45:26 briansIMAC.local CCN X[2153] <Error>: kCGErrorIllegalArgument: _CGSFindSharedWindow: WID 89611/1/10 12:45:26 PM [0x0-0xc70c7].com.brianstevens.ccnx[2153] Mon Nov 1 12:45:26 briansIMAC.local CCN X[2153] <Error>: kCGErrorIllegalArgument: CGSGetWindowTags: Invalid window 0x38011/1/10 1:34:26 PM CCN X[2153] November 201011/1/10 1:34:28 PM CCN X[2153] kCGErrorIllegalArgument: _CGSFindSharedWindow: WID 105911/1/10 1:34:28 PM CCN X[2153] kCGErrorIllegalArgument: CGSGetWindowTags: Invalid window 0x42311/1/10 1:34:28 PM [0x0-0xc70c7].com.brianstevens.ccnx[2153] Mon Nov 1 13:34:28 briansIMAC.local CCN X[2153] <Error>: kCGErrorIllegalArgument: _CGSFindSharedWindow: WID 105911/1/10 1:34:28 PM [0x0-0xc70c7].com.brianstevens.ccnx[2153] Mon Nov 1 13:34:28 briansIMAC.local CCN X[2153] <Error>: kCGErrorIllegalArgument: CGSGetWindowTags: Invalid window 0x423
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
Posted by: fblistserve <fblistserve@...>
I’m calling the following code in an attempt to print the contentView of a Carbon window. Two different windows ( i.e. different content and different WindowRefs ) but the same window attributes ( class is document window etc. ) produce the same result. Both windows are nibs. The WindowRef shows the correct window in the debugger as it enters the called function ( so the right window is being passed ) but the print of the contentView fails with an invalid window. Activating the pool makes no difference in the results that I can see.
Any ideas for debugging( or corrections to my code ) or different methods for achieving the same result ( without using deprecated calls ) are very welcome.
TIA
Brian S
BeginCFunction
void PrintContentViewOfCarbonWindow( WindowRef carbonWindow )
{
//NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSWindow *cocoaWindow = [ [ [ NSWindow alloc ] initWithWindowRef:carbonWindow ] retain ];
NSLog(@"%@",[cocoaWindow title]);
[[cocoaWindow contentView] print:nil];
//[pool release];
[cocoaWindow release];
}
endC
11/1/10 12:45:24 PM CCN X[2153] Calendar <<======= this is the NSLog call
11/1/10 12:45:26 PM CCN X[2153] kCGErrorIllegalArgument: _CGSFindSharedWindow: WID 896
11/1/10 12:45:26 PM CCN X[2153] kCGErrorIllegalArgument: CGSGetWindowTags: Invalid window 0x380
11/1/10 12:45:26 PM [0x0-0xc70c7].com.brianstevens.ccnx[2153] Mon Nov 1 12:45:26 briansIMAC.local CCN X[2153] <Error>: kCGErrorIllegalArgument: _CGSFindSharedWindow: WID 896
11/1/10 12:45:26 PM [0x0-0xc70c7].com.brianstevens.ccnx[2153] Mon Nov 1 12:45:26 briansIMAC.local CCN X[2153] <Error>: kCGErrorIllegalArgument: CGSGetWindowTags: Invalid window 0x380
11/1/10 1:34:26 PM CCN X[2153] November 2010
11/1/10 1:34:28 PM CCN X[2153] kCGErrorIllegalArgument: _CGSFindSharedWindow: WID 1059
11/1/10 1:34:28 PM CCN X[2153] kCGErrorIllegalArgument: CGSGetWindowTags: Invalid window 0x423
11/1/10 1:34:28 PM [0x0-0xc70c7].com.brianstevens.ccnx[2153] Mon Nov 1 13:34:28 briansIMAC.local CCN X[2153] <Error>: kCGErrorIllegalArgument: _CGSFindSharedWindow: WID 1059
11/1/10 1:34:28 PM [0x0-0xc70c7].com.brianstevens.ccnx[2153] Mon Nov 1 13:34:28 briansIMAC.local CCN X[2153] <Error>: kCGErrorIllegalArgument: CGSGetWindowTags: Invalid window 0x423
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
Click for thumbs down.0Click for thumbs up.0