简体   繁体   English

如何自定义 wxApp 实现协议?

[英]how to customize wxApp to implement protocol?

I am currently using both wxWidgets and CEF framework to build a simple application.我目前正在使用wxWidgetsCEF框架来构建一个简单的应用程序。 While trying to work out a clean quit, I figured out that CEF needs the application to implement CefAppProtocol so that certain events can be sent back.在尝试彻底退出时,我发现 CEF 需要应用程序来实现CefAppProtocol以便可以发回某些事件。 Currently my code crashes with an exception [wxNSApplication isHandlingSendEvent]: unrecognized selector sent to instance 0 .目前我的代码崩溃并出现异常[wxNSApplication isHandlingSendEvent]: unrecognized selector sent to instance 0 I am assuming this has to do with the wxApp default implementation.我假设这与wxApp默认实现有关。 Query is how do I make sure that my instance/ class of wxApp confirms to CefAppProtocol ?查询是如何确保我的wxApp实例/ class 确认到CefAppProtocol

wxApp itself doesn't inherit from NSApplication , but you should be able to override wxApp::OSXCreateAppController() to create a custom "controller", which is used as a delegate with [NSApplication sharedApplication] and thus should allow you to handle unknown selectors. wxApp本身不继承自NSApplication ,但是您应该能够覆盖wxApp::OSXCreateAppController()以创建自定义“控制器”,该控制器用作[NSApplication sharedApplication]的委托,因此应该允许您处理未知的选择器.

However, it's the "instance 0" part of the message that looks worrisome to me -- doesn't this mean that something is nil when it shouldn't be?然而,让我担心的是消息中的“实例 0”部分——这是否意味着某些东西在不应该是 nil 的时候是 nil ?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何实现网络协议? - How to implement a network protocol? 如何实现协议适配器 - how to implement a protocol adapter 如何实施协议 - How to implement a protocol 如何在glfw应用程序中实现NSApplicationDelegate协议 - How to implement NSApplicationDelegate protocol in glfw application 如何构建自定义libcurl以仅支持HTTP / HTTPS协议 - how to build customize libcurl to support HTTP / HTTPS protocol only 如何在Android上的JNI中实现委托/协议(在iOS上)? - How to implement delegate/protocol(on iOS) in JNI on Android? wxWidgets:如何在不使用宏且不进入主应用程序循环的情况下初始化wxApp? - wxWidgets: How to initialize wxApp without using macros and without entering the main application loop? 如何在Qt中编写Client-Server应用程序并实现简单的协议 - How to write Client-Server application and implement simple protocol in Qt 如何在FAST金融协议中实施Feed A和Feed B的仲裁? - how to implement arbitration of feed A and feed B in FAST financial protocol? OpenCV IOS Swift 2:如何实现CvVideoCameraDelegate协议处理视频帧 - OpenCV IOS Swift 2 :How to implement the CvVideoCameraDelegate protocol process Video Frames
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM