J'essaie de créer une fenêtre Cocoa dans une application Carbon (c'est une API OpenGL qui utilise AGL.) Impossible de la modifier.Définir le focus sur une fenêtre Cocoa dans Carbon App
Voici un snippit de code:
WindowRef winref = static_cast<eq::AGLWindow*>(getOSWindow())->getCarbonWindow();
vc = [[SFAttachedViewController alloc] initWithConfig:config]; //loads from view nib
NSPoint buttonPoint = NSMakePoint(event.pointerButtonPress.x + [cocoaWrap frame].origin.x, [cocoaWrap frame].size.height - event.pointerButtonPress.y + [cocoaWrap frame].origin.y);
MAAttachedWindow *attachedWindow = [[MAAttachedWindow alloc] initWithView:[vc view] attachedToPoint:buttonPoint onSide:side atDistance:0.0f]; // some Matt Gemmell goodness!
Et je tente de le montrer avec l'une des lignes suivantes:
// A)
[NSApp runModalForWindow:[attachedWindow retain]]; // makes a white box
// B)
NSWindow *cocoaWrap = [[NSWindow alloc] initWithWindowRef:winref];
[cocoaWrap addChildWindow:attachedWindow ordered:NSWindowAbove];
// C)
[attachedWindow makeKeyAndOrderFront:NSApp];
Les spectacles de fenêtre, mais l'accent est jamais donné. Je ne peux pas éditer l'un des contrôles, et tout est grisé.
aide !?
J'ai essayé
HIViewRef viewRef;
HICocoaViewCreate([vc view], 0, &viewRef);
WindowRef attachedRef = (WindowRef)[attachedWindow windowRef];
SetKeyboardFocus(attachedRef, viewRef, kControlNoPart);
Pensant qu'il aurait pu être une chose carbone/cacao, mais en vain.
Avez-vous déjà regardé ce PDF? http://developer.apple.com/legacy/mac/library/documentation/Cocoa/Conceptual/CarbonCocoaDoc/CarbonCocoaIntegration.pdf – JeremyP
Oui, c'est pourquoi j'ai eu l'appel NSApplicationLoad() dans ma fenêtre init() au lieu de dans le fil principal. –