mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-08 23:46:24 -06:00
FIX: [STUDIO-3217] hide dropdown when combobox move by scroll
Change-Id: I8d8e9ec4a54f6418843463f1bf4f1f46fd4af3df
This commit is contained in:
parent
cbb69c415a
commit
869a3046aa
2 changed files with 21 additions and 1 deletions
|
@ -19,6 +19,17 @@ END_EVENT_TABLE()
|
||||||
* calling Refresh()/Update().
|
* calling Refresh()/Update().
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
static wxWindow *GetScrollParent(wxWindow *pWindow)
|
||||||
|
{
|
||||||
|
wxWindow *pWin = pWindow;
|
||||||
|
while (pWin->GetParent()) {
|
||||||
|
auto pWin2 = pWin->GetParent();
|
||||||
|
if (auto top = dynamic_cast<wxScrollHelper *>(pWin2)) return dynamic_cast<wxWindow *>(pWin);
|
||||||
|
pWin = pWin2;
|
||||||
|
}
|
||||||
|
return pWin;
|
||||||
|
}
|
||||||
|
|
||||||
ComboBox::ComboBox(wxWindow *parent,
|
ComboBox::ComboBox(wxWindow *parent,
|
||||||
wxWindowID id,
|
wxWindowID id,
|
||||||
const wxString &value,
|
const wxString &value,
|
||||||
|
@ -50,6 +61,8 @@ ComboBox::ComboBox(wxWindow * parent,
|
||||||
} else {
|
} else {
|
||||||
GetTextCtrl()->Bind(wxEVT_KEY_DOWN, &ComboBox::keyDown, this);
|
GetTextCtrl()->Bind(wxEVT_KEY_DOWN, &ComboBox::keyDown, this);
|
||||||
}
|
}
|
||||||
|
if (auto scroll = GetScrollParent(this))
|
||||||
|
scroll->Bind(wxEVT_MOVE, &ComboBox::onMove, this);
|
||||||
drop.Bind(wxEVT_COMBOBOX, [this](wxCommandEvent &e) {
|
drop.Bind(wxEVT_COMBOBOX, [this](wxCommandEvent &e) {
|
||||||
SetSelection(e.GetInt());
|
SetSelection(e.GetInt());
|
||||||
e.SetEventObject(this);
|
e.SetEventObject(this);
|
||||||
|
@ -281,6 +294,12 @@ void ComboBox::keyDown(wxKeyEvent& event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ComboBox::onMove(wxMoveEvent &event)
|
||||||
|
{
|
||||||
|
event.Skip();
|
||||||
|
drop.Hide();
|
||||||
|
}
|
||||||
|
|
||||||
void ComboBox::OnEdit()
|
void ComboBox::OnEdit()
|
||||||
{
|
{
|
||||||
auto value = GetTextCtrl()->GetValue();
|
auto value = GetTextCtrl()->GetValue();
|
||||||
|
|
|
@ -88,6 +88,7 @@ private:
|
||||||
void mouseDown(wxMouseEvent &event);
|
void mouseDown(wxMouseEvent &event);
|
||||||
void mouseWheelMoved(wxMouseEvent &event);
|
void mouseWheelMoved(wxMouseEvent &event);
|
||||||
void keyDown(wxKeyEvent &event);
|
void keyDown(wxKeyEvent &event);
|
||||||
|
void onMove(wxMoveEvent &event);
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue