Devexpress Repository ComboBoxEdit loosing cursor position. Edit.SelectionStart Not being assigned
Posted
by
user575219
on Stack Overflow
See other posts from Stack Overflow
or by user575219
Published on 2014-08-22T15:28:11Z
Indexed on
2014/08/25
16:20 UTC
Read the original article
Hit count: 246
I am having an issue with my comboBoxEdit in a gridcontrol. I am using Winforms Devepress 11.2. I clicked in the text of an existing Repository comboBoxEdit, and typed in "appear backwards", however, it displayed as "sdrawkcab raeppa" like it would in a mirror.
There are some posts about this topic but none of the solutions seem to work
The reason for this is the following
foreach (GridColumn column in this.gvNotes.Columns)
{
var columnEdit = column.ColumnEdit;
if (columnEdit != null)
{
column.ColumnEdit.EditValueChanged += this.PostEditValueChanged;
}
}
private void PostEditValueChanged(object sender, EventArgs e)
{
this.gvNotes.PostEditor();
}
This PostEditor ensures the save button is enabled when the user is still in the current cell. The user does not need to leave the cell or change column for the changes to be posted to the grid.
So this is what I did:
private void PostEditValueChanged(object sender, EventArgs e)
{
ComboBoxEdit edit = this.gridNotes.FocusedView.ActiveEditor as ComboBoxEdit;
if (edit != null)
{
int len = edit.SelectionLength;
int start = edit.SelectionStart;
gridNotes.FocusedView.PostEditor();
edit.SelectionLength = len;
edit.SelectionStart = start;
}
This did not solve the problem of the cursor resetting to the start position. Edit.SelectionStart is not being assinged to the len value.Even though len changes to 1 edit.SelectionStart remains at 0 Does anyone know what event needs to be handled to not loose the cursor position?
© Stack Overflow or respective owner