You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Something from the Siemens update to the ComboBox editor is causing a "Error creating window handle" exception to be thrown when a value is changed in a cell that already has a value.
Steps to Reproduce
Create new .NET framework project w/ reference to SourceGrid and paste in Form Code from below and run app
Pick a body grid cell and enter a text value (e.g. "1")
Tab out of the cell
Go back into the cell that had text entered and press a key for a new value to trigger the exception to be thrown
Notes/Comments
In my actual project I'm using the grid and combobox cell control to allow the user to enter a numeric value or one of the predefined flags from the enum
I'm using a SourceGrid.Cells.Controller.ControllerBase derived implementation that persists the string value to the underlying model object (and checks that non-numeric strings are one of the enum values).
This error did not show up in the last version of the code found on the CodePlex repository (version 4.40) and appears to be related to the changes made in this repository that were committed by @sandhraprakash (sorry for the tag - hoping you'd know what might be the issue) where the SourceGrid.Cells.Editors.ComboBox had its reference to a DevAge.Windows.Forms.DevAgeComboBox replaced with the new class DevAge.Windows.Forms.UIComboBox
Form Code
usingSystem;usingSystem.Windows.Forms;namespaceTestingCombobox{internalstaticclassProgram{publicenumEnumOptions{A,B,C,}/// <summary>/// The main entry point for the application./// </summary>[STAThread]staticvoidMain(){Application.EnableVisualStyles();Application.SetCompatibleTextRenderingDefault(false);EnumOptions[]oOptions=(EnumOptions[])Enum.GetValues(typeof(EnumOptions));FormoForm=newForm();SourceGrid.GridoGrid=newSourceGrid.Grid(){Dock=DockStyle.Fill,};oGrid.Redim(4,4);for(inti=0;i<3;i++){oGrid[0,i+1]=newSourceGrid.Cells.ColumnHeader((i+1).ToString());oGrid[i+1,0]=newSourceGrid.Cells.RowHeader((i+1).ToString());}for(inti=0;i<3;i++){for(intj=0;j<3;j++){SourceGrid.Cells.Editors.ComboBoxoEditor=newSourceGrid.Cells.Editors.ComboBox(typeof(string),oOptions,false);oGrid[i+1,j+1]=newSourceGrid.Cells.Cell(null,oEditor);}}oForm.Controls.Add(oGrid);Application.Run(oForm);}}}
The text was updated successfully, but these errors were encountered:
It appears to be from the change in SourceGrid\Cells\Editors\EditorControlBase.cs line 137 in InternalStartEdit() where the control was moved "here for improved performance". But it doesn't check whether a control was already created, so it just keeps creating new ones every time it starts an edit.
Old code:
//[email protected]: moved from constructor to here to improve performancemControl=CreateControl();
Fixed code:
//[email protected]: moved from constructor to here to improve performanceif(mControl==null)mControl=CreateControl();
I'm still trying to figure out Github and will try to submit a patch.
Also another bug fix is needed in SourceGrid\Cells\Editors\EditorControlBase.cs line 151:
Old code: c# Control.Text = key.ToString();
Fixed code: c# Control.ComboBox.Text = key.ToString();
Something from the Siemens update to the ComboBox editor is causing a "Error creating window handle" exception to be thrown when a value is changed in a cell that already has a value.
Steps to Reproduce
Form Code
from below and run appNotes/Comments
SourceGrid.Cells.Controller.ControllerBase
derived implementation that persists the string value to the underlying model object (and checks that non-numeric strings are one of the enum values).SourceGrid.Cells.Editors.ComboBox
had its reference to aDevAge.Windows.Forms.DevAgeComboBox
replaced with the new classDevAge.Windows.Forms.UIComboBox
Form Code
The text was updated successfully, but these errors were encountered: