Skip to content

Commit

Permalink
[Gtk] Remove double subscription to SelectionChanged event.
Browse files Browse the repository at this point in the history
The ListBox backend was adding its own handler to the underlying widget selection changed event using the base TableView sink. The issue is that the parent TableView does the same thing which results in the client code handler for selection changed to be called twice in a row for each single modification.
  • Loading branch information
garuma committed Dec 16, 2016
1 parent 07a2140 commit 357d023
Showing 1 changed file with 0 additions and 25 deletions.
25 changes: 0 additions & 25 deletions Xwt.Gtk/Xwt.GtkBackend/ListBoxBackend.cs
Expand Up @@ -69,31 +69,6 @@ public void SetViews (CellViewCollection views)
foreach (var v in views)
CellUtil.CreateCellRenderer (ApplicationContext, Frontend, this, theColumn, v);
}

public override void EnableEvent (object eventId)
{
base.EnableEvent (eventId);
if (eventId is TableViewEvent) {
if (((TableViewEvent)eventId) == TableViewEvent.SelectionChanged)
Widget.Selection.Changed += HandleWidgetSelectionChanged;
}
}

public override void DisableEvent (object eventId)
{
base.DisableEvent (eventId);
if (eventId is TableViewEvent) {
if (((TableViewEvent)eventId) == TableViewEvent.SelectionChanged)
Widget.Selection.Changed -= HandleWidgetSelectionChanged;
}
}

void HandleWidgetSelectionChanged (object sender, EventArgs e)
{
ApplicationContext.InvokeUserCode (delegate {
EventSink.OnSelectionChanged ();
});
}
}
}

0 comments on commit 357d023

Please sign in to comment.