[Mono-dev] Patches for mono-winforms

Steven Boswell II ulatekh at yahoo.com
Fri Jun 1 03:25:32 UTC 2012

I work in a shop where our apps are written with C# and WinForms.  Thank God for Mono; I'm allowed to do all my work under Linux with Mono, and my code works fine under MS Windows and .NET.

Recently, I ran into a showstopper bug in mono-winforms, and finally decided to look through the code.  I fixed the bug quickly.  That led me to looking for the source of other, non-showstopper bugs I've encountered, and those went quickly too.  Enclosed is an archive with all of the bug fixes I made, which were made against the latest version on GitHub.  (I originally made these bug fixes against version 2.10.5, the most recent one in Fedora Core 16's yum repos.)

Patch 1 implements the EditingControlShowing event in DataGridView.  Before, it wasn't called at all.  I had to split a DataGridViewCell.StyleEditingControl() method off of DataGridViewCell.InitializeEditingControl(); under .NET, ComboBox.Items is initialized before EditingControlShowing is posted, and this split was necessary to get Mono to work that way too.  Styles modified in the EditingControlShowing event are now applied to text-box and checkbox controls too, not just combo-boxes.

Patch 2 resolves different behavior between .NET and Mono when the user leaves a DataGridView.  Under .NET, the last-edited cell is committed; under Mono, changed made to the last-edited cell are lost.  It was a one-line fix.

Patch 3 fires the DataGridView.SelectionChanged event when the selected rows/columns changes.  Before, the values of the SelectedRows and SelectedColumns properties were semi-random during the SelectionChanged event; now they're accurate.

Patches 4 and 5 fix two different exception-throws I encountered when ComboBox.Items.Remove() is called with an item that's not in the combo box.  .NET doesn't throw any exceptions in this case.

Patch 6 fixes the implementation of BackColor on ToolStripItem objects.  Now it behaves like it does under .NET, i.e. the BackColor setting on menu items etc. shows up.

I would very much appreciate it if you would consider committing these changes.  My MS-Windows-oriented co-workers were impressed by how quickly bugs in Mono can be found and fixed.  Who knows, maybe I'll get some converts to open-source.  (It amazes me that this sort of thing still has to be evangelized...sigh.)

Steven Boswell
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-devel-list/attachments/20120531/0c0a7f6c/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mwf-patches.tar.bz2
Type: application/octet-stream
Size: 2262 bytes
Desc: not available
URL: <http://lists.ximian.com/pipermail/mono-devel-list/attachments/20120531/0c0a7f6c/attachment-0001.obj>

More information about the Mono-devel-list mailing list