netease-kit / NIM_PC_Demo

云信Windows(PC) C/C++ Demo源码仓库
Other
275 stars 174 forks source link

控件的AttachAllEvents 捕获不到kEventSystemKey ,比如捕获不到 ALT按键动作 #110

Open cloud14k opened 4 months ago

cloud14k commented 4 months ago

我在一个label中使用lb_show_hideboard= (ui::Label)FindControl(L"show_hide_board");
lb_show_hideboard->AttachAllEvents(nbase::Bind(&KbShutcutsForm::OnLbShowHideBoardNotify, this, std::placeholders::_1)); bool KbShutcutsForm::OnLbShowHideBoardNotify(ui::EventArgs
msg) {
if (msg->Type == kEventSystemKey) { ui::EventArgs* m = msg;
} } 按alt进入不到这个kEventSystemKey 过程,请帮忙解答一下,不胜感激。

nmgwddj commented 4 months ago

All events 事件在统一的 Control 基类中处理,这部分代码也是完全开放的,可尝试在派发 AllEvent 事件位置下断点排查系统回调上来的消息,参考这里代码:https://github.com/netease-kit/NIM_PC_Demo/blob/master/tool_kits/duilib/Core/Control.cpp#L740-L742

另外除了基于源码调试外,我个人一些历史经验可以参考: