[Mono-dev] Patches for mono-winforms

Rob Wilkens robwilkens at gmail.com
Sun Jun 3 01:46:58 UTC 2012

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...

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-devel-list/attachments/20120602/1c0fe01c/attachment.html>

More information about the Mono-devel-list mailing list