コード例 #1
0
void DIALOG_TEXT_PROPERTIES::OnCharHook( wxKeyEvent& aEvent )
{
    if( aEvent.GetKeyCode() == WXK_TAB )
    {
        int flags = 0;

        if( !aEvent.ShiftDown() )
            flags |= wxNavigationKeyEvent::IsForward;

        if( aEvent.ControlDown() )
            flags |= wxNavigationKeyEvent::WinChange;

        NavigateIn( flags );
    }
    else if( aEvent.GetKeyCode() == WXK_RETURN )
    {
        if( FindFocus() == m_MultiLineText && !aEvent.ShiftDown() )
            aEvent.Skip();
        else
        {
            TransferDataFromWindow();
            EndModal( wxID_OK );
        }
    }
    else
    {
        aEvent.Skip();
    }
}
コード例 #2
0
void KeyConfigPrefs::OnHotkeyKeyDown(wxKeyEvent & e)
{
   wxTextCtrl *t = (wxTextCtrl *)e.GetEventObject();

   // Make sure we can navigate away from the hotkey textctrl.
   // On Linux and OSX, it can get stuck, but it doesn't hurt
   // to do it for Windows as well.
   //
   // Mac note:  Don't waste time trying to figure out why the
   // focus goes back to the prefs tree.  Unless Voiceover is
   // active, buttons on the Mac do not accept focus and all the
   // controls between this one and the tree control are buttons.
   if (e.GetKeyCode() == WXK_TAB) {
      NavigateIn(e.ShiftDown()
                 ? wxNavigationKeyEvent::IsBackward
                 : wxNavigationKeyEvent::IsForward);
      return;
   }

   t->SetValue(KeyStringDisplay(KeyEventToKeyString(e)));
}