duilib的list控件的键盘上下键激活并获取子项名失败的bug
来源:互联网 发布:java 二维数组初始化 编辑:程序博客网 时间:2024/05/21 21:01
这个主要是解决在属性列表中,按键盘的上下键获取节点的值出错的问题
duilib的源码
void CListUI::DoEvent(TEventUI& event){ if( !IsMouseEnabled() && event.Type > UIEVENT__MOUSEBEGIN && event.Type < UIEVENT__MOUSEEND ) { if( m_pParent != NULL ) m_pParent->DoEvent(event); else CVerticalLayoutUI::DoEvent(event); return; } if( event.Type == UIEVENT_SETFOCUS ) { m_bFocused = true; return; } if( event.Type == UIEVENT_KILLFOCUS ) { m_bFocused = false; return; } if( event.Type == UIEVENT_KEYDOWN ) { if (IsKeyboardEnabled() && IsEnabled()) { switch( event.chKey ) { case VK_UP: SelectItem(FindSelectable(m_iCurSel - 1, false), true); case VK_DOWN: SelectItem(FindSelectable(m_iCurSel + 1, true), true); case VK_PRIOR: PageUp(); case VK_NEXT: PageDown(); case VK_HOME: SelectItem(FindSelectable(0, false), true); case VK_END: SelectItem(FindSelectable(GetCount() - 1, true), true); case VK_RETURN: if( m_iCurSel != -1 ) GetItemAt(m_iCurSel)->Activate(); } return; } } if( event.Type == UIEVENT_SCROLLWHEEL ) { if (IsEnabled()) { switch( LOWORD(event.wParam) ) { case SB_LINEUP: if( m_bScrollSelect ) SelectItem(FindSelectable(m_iCurSel - 1, false), true); else LineUp(); return; case SB_LINEDOWN: if( m_bScrollSelect ) SelectItem(FindSelectable(m_iCurSel + 1, true), true); else LineDown(); return; } } } CVerticalLayoutUI::DoEvent(event);}
改进之后
void CListUI::DoEvent(TEventUI& event){ if( !IsMouseEnabled() && event.Type > UIEVENT__MOUSEBEGIN && event.Type < UIEVENT__MOUSEEND ) { if( m_pParent != NULL ) m_pParent->DoEvent(event); else CVerticalLayoutUI::DoEvent(event); return; } if( event.Type == UIEVENT_SETFOCUS ) { m_bFocused = true; return; } if( event.Type == UIEVENT_KILLFOCUS ) { m_bFocused = false; return; } if( event.Type == UIEVENT_KEYDOWN ) { if (IsKeyboardEnabled() && IsEnabled()) { *switch( event.chKey ) { case VK_UP: SelectItem(FindSelectable(m_iCurSel - 1, false), true); if (m_iCurSel != -1) GetItemAt(m_iCurSel)->Activate(); break; case VK_DOWN: SelectItem(FindSelectable(m_iCurSel + 1, true), true); if (m_iCurSel != -1) GetItemAt(m_iCurSel)->Activate(); break; case VK_PRIOR: PageUp(); if (m_iCurSel != -1) GetItemAt(m_iCurSel)->Activate(); break; case VK_NEXT: PageDown(); if (m_iCurSel != -1) GetItemAt(m_iCurSel)->Activate(); break; case VK_HOME: SelectItem(FindSelectable(0, false), true); if (m_iCurSel != -1) GetItemAt(m_iCurSel)->Activate(); break; case VK_END: SelectItem(FindSelectable(GetCount() - 1, true), true); if (m_iCurSel != -1) GetItemAt(m_iCurSel)->Activate(); break; case VK_RETURN: if( m_iCurSel != -1 ) GetItemAt(m_iCurSel)->Activate(); break;* } return; } } if( event.Type == UIEVENT_SCROLLWHEEL ) { if (IsEnabled()) { switch( LOWORD(event.wParam) ) { case SB_LINEUP: if( m_bScrollSelect ) SelectItem(FindSelectable(m_iCurSel - 1, false), true); else LineUp(); return; case SB_LINEDOWN: if( m_bScrollSelect ) SelectItem(FindSelectable(m_iCurSel + 1, true), true); else LineDown(); return; } } } CVerticalLayoutUI::DoEvent(event);}
阅读全文
0 0
- duilib的list控件的键盘上下键激活并获取子项名失败的bug
- duilib的一些bug
- duilib List控件,横向滚动时列表项不移动或者移动错位的bug的修复
- duilib List控件,横向滚动时列表项不移动或者显示错位的bug的修复
- 修复duilib CEditUI控件和CWebBrowserUI控件中按Tab键无法切换焦点的bug
- duilib进阶教程 -- Container控件的bug (14)
- duilib进阶教程 -- TreeView控件的bug (9)
- duilib进阶教程 -- Label控件的bug (8)
- 修复duilib库UISlider控件的4个bug
- duilib relativepos属性导致控件错误的bug修复
- duilib中设置不激活窗口后移动无法立即跟随的bug
- 如何用键盘上下键来控制gridview list行的选择
- duilib : 静态控件的点击
- duilib flash控件的使用
- duilib控件的所有事件
- duilib 修复CTreeViewUI控件动态添加子控件时,对是否显示判断不足的bug
- duilib list 获取选中的行ID 获取行数 获取行指针 获取本行索引
- 【duilib界面库】duilib界面库(干货) 修复UIScrollBar鼠标移出控件外显示异常的BUG
- Servlet线程不安全问题
- Struts2 validate验证
- django中的小坑
- Test 2017.10.19
- HDC-2000 ASCII码排序(两种解法)
- duilib的list控件的键盘上下键激活并获取子项名失败的bug
- linux网络编程之socket(三):最简单的回射客户/服务器程序、time_wait 状态
- C语言中结构定义
- java中获取当前服务器的Ip地址
- 【Android界面实现】解决ScrollView中嵌套Listview,Listview中嵌套Listview显示不完整和滑动冲突的问题
- centos时间网络同步
- java 7744问题
- NOIP模拟(10.19)T2 弹球
- 北京政策——户口与房子