consume tab key press in single-widget dropdown

Change-Id: Ie23fa35d29c20910514f3aaad095521f1588702b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96367
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
Caolán McNamara 2020-06-15 14:55:28 +01:00
parent d6533cb372
commit 1067bf8a78
2 changed files with 17 additions and 0 deletions

View file

@ -278,6 +278,10 @@ IMPL_LINK(ScFilterListBox, KeyInputHdl, const KeyEvent&, rKeyEvent, bool)
bDone = true;
}
// nowhere to tab to
if (aCode.GetCode() == KEY_TAB)
bDone = true;
return bDone;
}

View file

@ -10,6 +10,7 @@
#include <DropDownFormFieldButton.hxx>
#include <edtwin.hxx>
#include <bookmrk.hxx>
#include <vcl/event.hxx>
#include <vcl/floatwin.hxx>
#include <vcl/InterimItemWindow.hxx>
#include <vcl/settings.hxx>
@ -53,6 +54,7 @@ private:
sw::mark::IFieldmark* m_pFieldmark;
DECL_LINK(MyListBoxHandler, weld::TreeView&, bool);
DECL_STATIC_LINK(SwFieldDialog, KeyInputHdl, const KeyEvent&, bool);
public:
SwFieldDialog(SwEditWin* parent, sw::mark::IFieldmark* fieldBM, long nMinListWidth);
@ -109,6 +111,7 @@ SwFieldDialog::SwFieldDialog(SwEditWin* parent, sw::mark::IFieldmark* fieldBM, l
lbSize.setWidth(std::max(lbSize.Width(), nMinListWidth));
m_xListBox->SetSizePixel(lbSize);
rTreeView.connect_row_activated(LINK(this, SwFieldDialog, MyListBoxHandler));
rTreeView.connect_key_press(LINK(this, SwFieldDialog, KeyInputHdl));
m_xListBox->Show();
rTreeView.grab_focus();
@ -147,6 +150,16 @@ IMPL_LINK(SwFieldDialog, MyListBoxHandler, weld::TreeView&, rBox, bool)
return true;
}
IMPL_STATIC_LINK(SwFieldDialog, KeyInputHdl, const KeyEvent&, rKeyEvent, bool)
{
bool bDone = false;
vcl::KeyCode aCode = rKeyEvent.GetKeyCode();
// nowhere to tab to
if (aCode.GetCode() == KEY_TAB)
bDone = true;
return bDone;
}
DropDownFormFieldButton::DropDownFormFieldButton(SwEditWin* pEditWin,
sw::mark::DropDownFieldmark& rFieldmark)
: FormFieldButton(pEditWin, rFieldmark)