Return focus to Editor after clicking a button in floating window of MAC

旧街凉风 提交于 2019-12-04 19:26:01

Are you saying you created an ANE in the keyboard app that is trying to convert the Window? An ANE seems to be the way to go unless you can configure the flex application to create its main window as an NSPanel instead of an NSWindow.

What you can do is create a panel the same size as the window then set the panel's content view to the window's content view. That will move all the window's contents to your newly created panel. Then call orderOut on the main window and makeKeyAndOrderFront on the panel. Here is similar code we had in Connect:

NSWindow *mainWindow = [[NSApp windows] objectAtIndex: 0];
NSView *mainContentView = [mainWindow contentView];

NSPanel *mainPanel = [[NSPanel alloc] initWithContentRect:[mainContentView frame]
                 styleMask:NSBorderlessWindowMask | NSNonactivatingPanelMask
                backing:NSBackingStoreBuffered defer:YES];

[mainPanel setContentView:mainContentView];
[mainPanel setLevel:NSScreenSaverWindowLevel];

[mainPanel makeKeyAndOrderFront:nil];
[mainContentView orderOut:nil];
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!