Added wxPropertyGrid::DedicateKey(), which prevents specific key presses from being eaten by editor controls. This is useful for customizing keyboard navigation. Also added utility function wxPGFindInVector<>(), which is used in the new code, and also in some other places.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64562 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1022,6 +1022,7 @@ void wxPropertyGrid::OnLabelEditorKeyPress( wxKeyEvent& event )
|
||||
{
|
||||
int keycode = event.GetKeyCode();
|
||||
|
||||
// If key code was registered as action trigger, then trigger that action
|
||||
if ( keycode == WXK_ESCAPE )
|
||||
{
|
||||
DoEndLabelEdit(false);
|
||||
@@ -5553,8 +5554,10 @@ void wxPropertyGrid::HandleKeyEvent( wxKeyEvent &event, bool fromChild )
|
||||
return;
|
||||
}
|
||||
|
||||
// Except for TAB and ESC, handle child control events in child control
|
||||
if ( fromChild )
|
||||
// Except for TAB, ESC, and any keys specifically dedicated to
|
||||
// wxPropertyGrid itself, handle child control events in child control.
|
||||
if ( fromChild &&
|
||||
wxPGFindInVector(m_dedicatedKeys, keycode) == wxNOT_FOUND )
|
||||
{
|
||||
// Only propagate event if it had modifiers
|
||||
if ( !event.HasModifiers() )
|
||||
@@ -5608,7 +5611,13 @@ void wxPropertyGrid::HandleKeyEvent( wxKeyEvent &event, bool fromChild )
|
||||
{
|
||||
p = wxPropertyGridIterator::OneStep( m_pState, wxPG_ITERATE_VISIBLE, p, selectDir );
|
||||
if ( p )
|
||||
DoSelectProperty(p);
|
||||
{
|
||||
// If editor was focused, then make the next editor focused as well
|
||||
int selFlags = 0;
|
||||
if ( editorFocused )
|
||||
selFlags |= wxPG_SEL_FOCUS;
|
||||
DoSelectProperty(p, selFlags);
|
||||
}
|
||||
wasHandled = true;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user