[Mono-dev] Patches for mono-winforms

Steven Boswell II ulatekh at yahoo.com
Sun Jun 3 13:07:12 UTC 2012


Crap, I didn't notice that InitializeEditingControl() was public.

My whole motivation for splitting up that method was to make sure that the style modified by the EditingControlShowing event-handler would be applied to the cell.  But that's done a few lines later, by the call to "dgvEditingControl.ApplyCellStyleToEditingControl (style)".  Argh.

In any case, enclosed is a much simpler patch that doesn't change the public API.  Hopefully I didn't do anything else stupid -- I'm truly not trying to waste your time. ;-)

Steven Boswell


________________________________
 From: Stifu <stifu at free.fr>
To: mono-devel-list at lists.ximian.com 
Sent: Sunday, June 3, 2012 1:33 AM
Subject: Re: [Mono-dev] Patches for mono-winforms
 
This patch does not look good to me, because you're changing the public API.

In DataGridViewCell, the InitializeEditingControl method expects 2
parameters rather than 3 after your patch, which means we're breaking the
API and are no longer compatible with .NET.


Steven Boswell II wrote
> 
> Argh...one more dumb oversight in my change.
> Enclosed is ANOTHER version of the patch.
> I wish I had the luxury of working on my hobbies when I was awake and
> energetic. ;-)
> 
> Steven Boswell
> 
> 
> ________________________________
>  From: Steven Boswell II <ulatekh@>
> To: "mono-devel-list at .ximian" <mono-devel-list at .ximian> 
> Sent: Saturday, June 2, 2012 7:58 PM
> Subject: Re: [Mono-dev] Patches for mono-winforms
>  
> 
> Rob, you're my hero.  Very few tests in DataGridViewTest.cs create a Form,
> but most of the ones that do involve data binding.
> I added a Form to my test, and it succeeded immediately.  Apparently,
> Application.Run() isn't necessary, but that was a good idea.
> Enclosed is a revised patch, for review by the Powers That Be.
> 
> Steven Boswell
> 
> 
> ________________________________
>  From: Rob Wilkens <robwilkens@>
> To: mono-devel-list at .ximian 
> Sent: Saturday, June 2, 2012 6:46 PM
> Subject: Re: [Mono-dev] Patches for mono-winforms
>  
> 
> On 06/02/2012 09:38 PM, Rob Wilkens wrote: 
> On 06/02/2012 08:55 PM, Steven Boswell II wrote: 
>>The EditingControlShowing event has to be called, and it has to be called
after the control's contents have been initialized properly...that's not
really two separate issues.
>>>
>>>
>>>The enclosed patch is an updated version; in addition to having a unit
test, it fixes one additional bug revealed by my testing. Before,
DataGridViewComboBoxCell.InitializeEditingControl() was setting the initial
value from the FormattedValue property, instead of the initialFormattedValue
parameter.
>>>
>>>
>>>I tried to write an additional unit test that worked with bound data, but
for the life of me I can't figure out why it doesn't work.  I've done
data-binding with DataGridView before...it wasn't this mysterious.  In my
unit test, after I set the DataGridView's DataSource property, the data-grid
doesn't initialize properly; instead of four rows, it ends up with one row,
and all its cell values are null.  After beating my head against the wall
for several hours, I'm perfectly happy to be told what a moron I am, if
someone will just tell me why the EditingControlShowingTest_Bound test
doesn't work. :-)
>>>
>>>
>>>Steven Boswell
>>>
>>Not writing to call you a moron, I'm a newbie myself and i could
>       be wrong...  But i copied and pasted your test code for
>       EditingControlShowingTest_Bound into Visual Studio 2010, but
>       rather than creating the DataGridVIew in code i placed it on the
>       form and modified your code to use the one on the form...  And i
>       disabled the asserts...  And from what i can tell it runs fine in
>       both .net and mono (that is, the data grid view populates).
>>
>>One thing that I noticed about your code, though, is it depends on
>       a 'showing' event..
>>
>>And i wonder if that means your datagridview needs to be placed on
>       a form which is displayed, so that it is actually shown...
>>
>>i.e. change your code something like this:
>>
>>using (Form Form1=new Form()){
>>    Form1.Controls.Add(_dataGridView);//optionaly set sizeand
>       location of both gridview and form
>>    Form1.Show();
>>
>>    ... insert the rest of your code here .... 
>>}
>>
> Oh, and if i'm right, you might need the equivalent of an
> Application.Run(Form1) to process the events since you're listening for
> events, just don't forget to close Form1 or the Run loop might never end
> and your test can hang up with a displayed window...
> 
> 
> 
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at .ximian
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
> 
> 
> 
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at .ximian
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at .ximian
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
> 

--
View this message in context: http://mono.1490590.n4.nabble.com/Patches-for-mono-winforms-tp4649620p4649670.html
Sent from the Mono - Dev mailing list archive at Nabble.com.
_______________________________________________
Mono-devel-list mailing list
Mono-devel-list at lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-devel-list/attachments/20120603/5902ebea/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mwf-01-DataGridView-EditingControlShowing.patch.bz2
Type: application/octet-stream
Size: 2624 bytes
Desc: not available
URL: <http://lists.ximian.com/pipermail/mono-devel-list/attachments/20120603/5902ebea/attachment-0001.obj>


More information about the Mono-devel-list mailing list