本文整理汇总了C++中KeyboardEvent::GetKey方法的典型用法代码示例。如果您正苦于以下问题:C++ KeyboardEvent::GetKey方法的具体用法?C++ KeyboardEvent::GetKey怎么用?C++ KeyboardEvent::GetKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KeyboardEvent
的用法示例。
在下文中一共展示了KeyboardEvent::GetKey方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnChar
void EditCtrl::OnChar( KeyboardEvent const & p_event )
{
eKEYBOARD_KEY l_code = p_event.GetKey();
if ( l_code >= 0x20 && l_code <= 255 && l_code != eKEY_DELETE )
{
DoAddCharAtCaret( p_event.GetChar() );
m_signals[eEDIT_EVENT_UPDATED]( m_caption );
}
}
示例2: OnKeyDown
void EditCtrl::OnKeyDown( KeyboardEvent const & p_event )
{
if ( !p_event.IsCtrlDown() && !p_event.IsAltDown() )
{
eKEYBOARD_KEY l_code = p_event.GetKey();
if ( l_code == eKEY_BACKSPACE )
{
DoDeleteCharBeforeCaret();
m_signals[eEDIT_EVENT_UPDATED]( m_caption );
}
else if ( l_code == eKEY_DELETE )
{
DoDeleteCharAtCaret();
m_signals[eEDIT_EVENT_UPDATED]( m_caption );
}
else if ( l_code == eKEY_LEFT && m_caretIt != m_caption.begin() )
{
m_caretIt--;
DoUpdateCaption();
}
else if ( l_code == eKEY_RIGHT && m_caretIt != m_caption.end() )
{
m_caretIt++;
DoUpdateCaption();
}
else if ( l_code == eKEY_HOME && m_caretIt != m_caption.begin() )
{
m_caretIt = m_caption.begin();
DoUpdateCaption();
}
else if ( l_code == eKEY_END && m_caretIt != m_caption.end() )
{
m_caretIt = m_caption.end();
DoUpdateCaption();
}
}
}