We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

What event gives the color a user selects in ColorEdit cell?

Thread ID:

Created:

Updated:

Platform:

Replies:

81123 May 13,2009 02:11 PM May 15,2009 09:09 AM Windows Forms 2
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On May 13, 2009 02:11 PM

I'll admit I'm a newbie when it comes to the intricacies of Syncfusion's grids, but I'm missing something in the event sequence.
Here's my simple experiment. My goal is to react when the user selects a color in a ColorEdit cell.

In a new WinForm, create a new GridControl. Edit it so that some cell (I've been picking on 1,1 for this experiment) has a cell type of ColorEdit.
Add a button to the form as well.
Add event callbacks for the button's click and for the grid's CurrentCellChanged. (I've also looked at the grid's StyleChanged, CellsChanged, QueryCellInfo, QueryCellModel, and BackColorChanged events, but they either never fire, or in the case of the queries, give me a recursive call error when I look at the internals of the cell within the event.)

My limited understanding is that CurrentCellChanged should fire when the user selects a color, and it does. But neither Text, FormattedText nor CellValue reflect the new value the user selected; nor does any field that I can look at in the debugger.

I let the code continue from there, set a breakpoint on the button's click callback, and use the debugger to check the values of the ColorEdit cell after clicking the button. Text, FormattedText and CellValue all reflect the new value.

I understand from this that I need to catch some event after CurrentCellChanged to get the new color, or look at some data I haven't looked at during the CurrentCellChanged event. What should I do?

Thanks for any help you can give!

Administrator [Syncfusion]
Replied On May 13, 2009 11:03 PM

It seems I (finally) found my own answer, when trying to deal with other combo boxes. Even when the combobox mode is set to Exclusive or Autocomplete, closing the drop down does not submit the edit to the underlying data store or complete editing. Once you complete editing, either the AcceptedChanges or EditingComplete events will show the new value. Since ColorEdit is a specialized ComboBox, it behaves in the same way.

If possible, I would still rather catch the event during CurrentCellChanged. I'm sure this must be easy, but if anyone wants to tell me what field to look at to see the user-entered text, that would give me all the information I need.

Thanks,

Scott

Rajadurai C [Syncfusion]
Replied On May 15, 2009 09:09 AM

Hi Scott,

Thanks for your interest in Syncfusion products.

After making change in cell, the changes cannot be saved in it until EndEdit() method is called. Please try the following code in CurrentCellChanged event in which ConfirmChanges() method forces the EndEdit() call thereby save the change and immediately reflect it.

void gridControl1_CurrentCellChanged(object sender, EventArgs e)
{
GridCurrentCell cc = this.gridControl1.CurrentCell;
cc.ConfirmChanges();
Console.WriteLine(this.gridControl1[cc.RowIndex,cc.ColIndex ].Text);
}


Regards,
Rajadurai

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;