Skip to content

Commit

Permalink
fix crash on menu item click - #303
Browse files Browse the repository at this point in the history
  • Loading branch information
buggins committed Oct 17, 2016
1 parent 525bb5e commit 84040a2
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/dlangui/widgets/lists.d
Original file line number Diff line number Diff line change
Expand Up @@ -1303,9 +1303,18 @@ class ListWidget : WidgetGroup, OnScrollHandler, OnAdapterChangeHandler {
itemrc.top += rc.top - scrollOffset.y;
itemrc.bottom += rc.top - scrollOffset.y;
if (itemrc.isPointInside(Point(event.x, event.y))) {
Widget itemWidget;
if (_adapter.wantMouseEvents)
itemWidget = _adapter.itemWidget(i);
if (_adapter && _adapter.wantMouseEvents) {
auto 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);
if ((event.flags & (MouseFlag.LButton || MouseFlag.RButton)) || _selectOnHover) {
if (_selectedItemIndex != i && itemEnabled(i)) {
Expand All @@ -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;
}
}
Expand Down

0 comments on commit 84040a2

Please sign in to comment.