mirror of https://github.com/buggins/dlangui.git
fix crash on menu item click - #303
This commit is contained in:
parent
525bb5e45f
commit
84040a277c
|
|
@ -1303,9 +1303,18 @@ class ListWidget : WidgetGroup, OnScrollHandler, OnAdapterChangeHandler {
|
||||||
itemrc.top += rc.top - scrollOffset.y;
|
itemrc.top += rc.top - scrollOffset.y;
|
||||||
itemrc.bottom += rc.top - scrollOffset.y;
|
itemrc.bottom += rc.top - scrollOffset.y;
|
||||||
if (itemrc.isPointInside(Point(event.x, event.y))) {
|
if (itemrc.isPointInside(Point(event.x, event.y))) {
|
||||||
Widget itemWidget;
|
if (_adapter && _adapter.wantMouseEvents) {
|
||||||
if (_adapter.wantMouseEvents)
|
auto itemWidget = _adapter.itemWidget(i);
|
||||||
itemWidget = _adapter.itemWidget(i);
|
if (itemWidget) {
|
||||||
|
Widget oldParent = itemWidget.parent;
|
||||||
|
itemWidget.parent = this;
|
||||||
|
if (event.action == MouseAction.Move && event.noModifiers && itemWidget.hasTooltip) {
|
||||||
|
itemWidget.scheduleTooltip(200);
|
||||||
|
}
|
||||||
|
//itemWidget.onMouseEvent(event);
|
||||||
|
itemWidget.parent = oldParent;
|
||||||
|
}
|
||||||
|
}
|
||||||
//Log.d("mouse event action=", event.action, " button=", event.button, " flags=", event.flags);
|
//Log.d("mouse event action=", event.action, " button=", event.button, " flags=", event.flags);
|
||||||
if ((event.flags & (MouseFlag.LButton || MouseFlag.RButton)) || _selectOnHover) {
|
if ((event.flags & (MouseFlag.LButton || MouseFlag.RButton)) || _selectOnHover) {
|
||||||
if (_selectedItemIndex != i && itemEnabled(i)) {
|
if (_selectedItemIndex != i && itemEnabled(i)) {
|
||||||
|
|
@ -1327,15 +1336,6 @@ class ListWidget : WidgetGroup, OnScrollHandler, OnAdapterChangeHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (itemWidget) {
|
|
||||||
Widget oldParent = itemWidget.parent;
|
|
||||||
itemWidget.parent = this;
|
|
||||||
if (event.action == MouseAction.Move && event.noModifiers && itemWidget.hasTooltip) {
|
|
||||||
itemWidget.scheduleTooltip(200);
|
|
||||||
}
|
|
||||||
//itemWidget.onMouseEvent(event);
|
|
||||||
itemWidget.parent = oldParent;
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue