Hi,
I have a UltraWinGrid where with a numeric column that is toggable on/off. I have created an UltraNumericEditor and added the ultraNumericEditor to the form. I assigned the EditorControl property of the column to the UltraNumericEditor. The UltraNumericEditor has been configured with a StateEditorButton in the ButtonsLeft collection (to toggle on/off) and a SpinEditorButton in the ButtonsRight collection (to increment/decrement by a custom amount).
I would like the cells in this column to display the numeric value and the checkbox in the grid.
My problem is that when I check the StateEditorButton of one cell, all of the cells in the column receive the new CheckState. I have tried using the InitializeCheckState event of the UltraNumericEditor, but I have not been able to make it work correctly. It seems as though the Editor/EditorControl remembers the state of the last active cell (???).
I have also tried creating a different UltraNumericEditor for the specific cell in each row of the grid. When I do this, I get an exception if the up/down spin button is held down that the cell is not in edit mode.
Any thoughts/help would be greatly appreciated. Has anyone been able to get a check box and numeric editor working for cells of a column in the grid?
Thanks in advance!
Hi Matt,
Thanks for the speedly response.
When I create an UltraNumericEditor for each row, and add the following handler for the EditorSpinButtonClick event, I get the exception listed below. Any thoughts? I have a simple app that I'm using as a test bed if that would help.
void numericEditor_EditorSpinButtonClick(object sender, SpinButtonClickEventArgs e)
try
{
gridCell.Value = value + 2;
}
The code works fine when I click the spin button, wait a couple seconds, and then click again. If I hold the spin button down, I get the following exception:
************** Exception Text **************System.NotSupportedException: The editor must be in edit mode. at Infragistics.Win.UltraWinEditors.EditorButtonSpinButtonUIElement.SpinButtonClick(ScrollButton direction, SpinButtonTypes buttonType) at Infragistics.Win.SpinButtonUIElement.SpinButtonClick(ScrollButton direction) at Infragistics.Win.SpinButtonUIElement.OnElementClick(Object sender, UIElementEventArgs e) at Infragistics.Win.ButtonUIElementBase.FireClickEvent() at Infragistics.Win.ScrollButtonUIElement.OnClick() at Infragistics.Win.ScrollButtonUIElement.TimerClickHelper() at System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry tme) at System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(Object obj) at System.Threading.ExecutionContext.runTryCode(Object userData) at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry tme) at System.Windows.Forms.Control.InvokeMarshaledCallbacks() at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
As it seems you have guessed, having a single editor for an entire column means that each cell will be using the same editor when it goes into edit mode, so having the editor maintain a single state will not work in this case. If you want to reuse the editor, you will need to maintain the list of what's checked or not somehow, either in the Tag property of a cell or some other data structure.
As for getting an exception when clicking the spin button, I'm not sure what the problem here is without seeing the exception, since the added spin button does not do anything by default. You could certainly try forcing the cell into edit mode yourself, such as "this.ultraGrid1.PerformAction(UltraGridAction.EnterEditMode);", and check to see if it was successful by either the return value or by checking to see if the ActiveCell is in edit mode.
-Matt