picoe / Eto

Cross platform GUI framework for desktop and mobile applications in .NET
Other
3.52k stars 319 forks source link

Gtk fix various treeview bugs #2643

Closed LeeARichardson closed 2 months ago

LeeARichardson commented 2 months ago

Fix a couple of selection related bugs in the Grid

If you switched to Multi mode, unselected everything, and switched back to Single then you could no longer select anything. I reproduced this in raw GtkSharp but I can't find the cause so this is a workaround. I don't think this would break anything if the underlying issue were fixed.

If you switched to Multi and back to Single you could no longer unselect anything. This was due to AllowMultipleSelection starting in Single but setting Browse.


Fix inability to select bottom row of GridView

This was caused by the header height not being taken into consideration. I did the fixes for the above issues in such a way as to remove the need for the mouse click handler altogether. That handler didn't account for unselecting with the keyboard anyway.


These fixes also address (I believe): https://github.com/picoe/Eto/issues/2335 https://github.com/picoe/Eto/issues/2401 https://github.com/picoe/Eto/issues/2443

and potentially some others but there are too many for me to check.

There are many inconsistencies between the platforms for what happens to the selection on switching modes or which events fire under which conditions. I've just tried to be sensible for what was already happening between Eto, Eto.Gtk, and GtkSharp and any other issues need to be addressed separately.

cwensley commented 2 months ago

Hey @LeeARichardson, this looks great! Thanks for the contribution. Only thing I'd recommend is checking if the path from GetCursor() is null before using it, as it looks like that API can return nulls.. e.g. if there's no data.

cwensley commented 2 months ago

Great! Thank you for the quick edits. 🙏