FIX: Dropdown click non grouped item

Change-Id: Ic2d073be946ed68ec249296e84d5bf97d6d9c587
Jira: STUDIO-12213 STUDIO-12208 STUDIO-12191 STUDIO-12192
(cherry picked from commit 00dfff142a6a24872b3c102d57814bb8c3bf0e2a)
This commit is contained in:
chunmao.guo
2025-05-15 15:05:39 +08:00
committed by Noisyfox
parent f5b1b4dfc5
commit 6423073c71
3 changed files with 17 additions and 12 deletions

View File

@@ -633,7 +633,9 @@ void DropDown::mouseReleased(wxMouseEvent& event)
pressedDown = false;
if (HasCapture())
ReleaseMouse();
if (hover_item >= 0 && subDropDown == nullptr) { // not moved
if (hover_item < 0)
return;
if (hover_item >= 0 && (subDropDown == nullptr || subDropDown->group.empty())) { // not moved
sendDropDownEvent();
if (mainDropDown)
mainDropDown->hover_item = -1; // To Dismiss mainDropDown
@@ -696,6 +698,7 @@ void DropDown::mouseMove(wxMouseEvent &event)
drop.Popup(&drop);
} else if (index >= 0) {
if (subDropDown) {
subDropDown->group.clear();
if (subDropDown->IsShown())
subDropDown->Dismiss();
}
@@ -723,7 +726,8 @@ void DropDown::mouseWheelMoved(wxMouseEvent &event)
if (hover >= (int) count) hover = -1;
if (hover != hover_item) {
hover_item = hover;
if (hover >= 0) SetToolTip(items[hover].tip);
if (auto index = hoverIndex(); index >= 0)
SetToolTip(items[index].tip);
}
paintNow();
}
@@ -732,7 +736,7 @@ void DropDown::mouseWheelMoved(wxMouseEvent &event)
void DropDown::sendDropDownEvent()
{
int index = hoverIndex();
if (index < 0)
if (index < 0 || (items[index].style & DD_ITEM_STYLE_DISABLED))
return;
wxCommandEvent event(wxEVT_COMBOBOX, GetId());
event.SetEventObject(this);