简体   繁体   中英

wxWidgets keyboard event

I have a problem with using Key event: there is example in documentation:

void OnChar(wxKeyEvent& event, double moveSpeed)
{
wxChar uc = event.GetUnicodeKey();
if ( uc != WXK_NONE )
{
    ...
}
else // No Unicode equivalent.
{
    // It's a special key, deal with all the known ones:
    switch ( event.GetKeyCode() )
    {
        case WXK_LEFT:
        case WXK_RIGHT:
            break;
        case WXK_F1:
            break;
    }
}

but what if i have to use keyboards event in different function ? I know that in other library you can simply use:

if (keyDown(SDLK_DOWN))
{
    //code
}

but how can I use that in wxwidgets ?

如果确实需要,可以使用wxGetKeyStats()函数 ,但是通常您确实希望对键盘事件做出反应,而不是检查键状态。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM