← Back to team overview

kicad-developers team mailing list archive

Re: Testing for hotkeys patch

 

Le 08/01/2016 03:15, Chris Pavlina a écrit :
> Here's a new patch. It fixes all previously mentioned bugs. In 
> particular, I have moved import/export back out into the menu to solve 
> the ambiguity issue.
> 
> However, I've uncovered a new bug. On Windows, if you try to select Tab 
> as a hotkey, the entire thing freezes up solid. This appears to be 
> related to it attempting to find the next item in an empty tab order.
> 
> A grotty fix is to add any tab-orderable item, such as a wxTextCtrl, 
> into the dialog.
> 
> I'm currently investigating a proper solution to this. Anybody with 
> Windows development experience is very much welcome to help me out here 
> - I have no idea what is going on with this in Windows, and it's hard to 
> debug because Windows builds take so long on my system...
> 
> I've tried turning off wxTAB_TRAVERSAL; that doesn't help (including a 
> grotty test hooking the wxDialog constructor to keep it from ever 
> putting that option in)...
> 
> On Thu, Jan 07, 2016 at 09:53:58AM -0500, Wayne Stambaugh wrote:
>> Chris,

To capture special keys like tab, return and some others, you could try
to use both wxEVT_CHAR and wxEVT_CHAR_HOOK.

However, because all key events are captured, you have to filter some
keys (especially modifier keys)

Something like (from widgets/widget_hotkey_list.cpp):

        SetMinClientSize( GetClientSize() );

        panel->Bind( wxEVT_CHAR, &HK_PROMPT_DIALOG::OnChar, this );
        panel->Bind( wxEVT_CHAR_HOOK, &HK_PROMPT_DIALOG::OnChar, this );
    }

    void OnChar( wxKeyEvent& aEvent )
    {
        m_event = aEvent;

        switch( m_event.GetKeyCode() )
        {
            case WXK_NONE:
            case WXK_SHIFT:
            case WXK_ALT:
            case WXK_CONTROL:
                return;

            default:
                break;
        }

        EndFlexible( wxID_OK );
    }



-- 
Jean-Pierre CHARRAS


Follow ups

References