Skip to content

Commit

Permalink
WIP selection consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
Lee Richardson committed Apr 15, 2024
1 parent 27135cd commit 8072ff2
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/Eto.Gtk/Forms/Controls/GridHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ protected override void Initialize()
Control.HasTooltip = true;

//Control.Selection.SelectFunction = SelectFunction;
Control.Selection.Changed += (sender, args) =>
/*Control.Selection.Changed += (sender, args) =>
{
//if (!AllowEmptySelection && AllowMultipleSelection)
{
Expand All @@ -178,7 +178,7 @@ protected override void Initialize()
Control.Selection.SelectPath(cursorRow);
}
}
};
};*/
}

private void Control_QueryTooltip(object o, Gtk.QueryTooltipArgs args)
Expand Down Expand Up @@ -778,21 +778,26 @@ private void SetSelectionMode(bool allowEmptySelection, bool allowMultipleSelect
if (currentMode == SelectionMode.Multiple && newMode != SelectionMode.Multiple)
{
// Workaround to not lose the ability to select after switching to Multi then back to Single or Browse.
//var firstSelectedRow = Control.Selection.GetSelectedRows().FirstOrDefault();//Control.Selection.CountSelectedRows() > 0 ? Control.Selection.GetSelectedRows()[0] : null;
var anyWereSelected = Control.Selection.CountSelectedRows() > 0;

Control.Selection.Mode = Gtk.SelectionMode.None;
Control.Selection.Mode = newMode;
//if (Control.Selection.CountSelectedRows() == 0)
if (anyWereSelected)
{
//SkipSelectedChange = true;
Control.GetCursor(out var cursorRow, out _);
Control.Selection.SelectPath(cursorRow);
//SkipSelectedChange = false;
}
}
Control.Selection.Mode = newMode;
}
if (!allowEmptySelection && Control.Selection.CountSelectedRows() == 0)
/*if (!allowEmptySelection && Control.Selection.CountSelectedRows() == 0)
{
Control.GetCursor(out var cursorRow, out _);
Control.Selection.SelectPath(cursorRow);
}
}*/

//EnsureSelection();
}
Expand Down

0 comments on commit 8072ff2

Please sign in to comment.