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.

Typing into selected cell automatically selects first character

Thread ID:

Created:

Updated:

Platform:

Replies:

62600 Jun 19,2007 03:07 AM Jun 22,2007 06:47 AM Windows Forms 6
loading
Tags: GridControl
Daniel Dusek
Asked On June 19, 2007 03:07 AM

Hi,
when I write a character in a cell, where the cursor is not displayed, then this character is automatically selected. So when typing the next character, the first character is deleted. So I have to write the first character twice. Then it works OK again (note: the cell is just selected, but the cursor is not inside of the cell).

Note: this is not a standard behaviour of the grid. Normally when you start to write to the cell, the first character will not be selected (e.g. like in excel). But I maintain a large project, where a lot of settings were changed.

Please can you give some hint, where to look to change this behaviour?
Thank you, Dan

haneefm [Syncfusion]
Replied On June 19, 2007 11:18 AM

Hi Dan,

You can try setting

[c#]
this.gridControl1.ActivateCurrentCellBehavior = GridCellActivateAction.SetCurrent;

This will make sure the current cell gets activated as you cursor into the cell. This happens by default when you click on a cell. It doesn't select the cell text when you click on a cell.

Best regards,
Haneef

Daniel Dusek
Replied On June 20, 2007 05:58 AM

Hi Haneef,
in the project, there is alredy this property set to 'DblClickOnCell'. But I have tried to use the setting you have proposed, but with this setting the cell-text gets selected after I click on the cell, and some more 'unwanted' things happen to the cell :-). So this is not the propper solution for me.

Have you another idea, how can I manage this problem please?

Thank you, Dan

haneefm [Syncfusion]
Replied On June 20, 2007 02:32 PM

Hi Dan,

You can handle the CurrentCellActivated event of the grid and change the selected text of the cell using the TextBox.SelectionStart property from the GridTextBoxCellRenderer object. Below are the code snippet

private void gridControl1_CurrentCellActivated(object sender, System.EventArgs e)
{
GridControl t_grid = sender as GridControl;
GridTextBoxCellRenderer cr = t_grid.CurrentCell.Renderer as GridTextBoxCellRenderer;
if( cr != null )
{
if( cr.TextBox.Text != string.Empty || cr.TextBox.Text.Length > 0)
{
cr.TextBox.SelectionLength = 0;
cr.TextBox.SelectionStart = cr.TextBox.Text.Length;
}
}
}

Best regards,
Haneef

Daniel Dusek
Replied On June 21, 2007 04:06 AM

Hi Haneef,
I have implemented the current cell activated event handler, but it did not helped. My problem is, that the cell is active, the selection is of zero lenght, the cursor is not in the cell, and at this moment I press some key, e.g. 'A' and the letter 'A' is written to the current cell, but the letter 'A' is selected. When I press the key 'A', then the event current cell activated is not catched at all.

I have also tested the key-press event. There I have seen, that selection is of zero lenght at the time when the key-press is catched. So the first character is selected 'after' the key-press' event.

Do you have some more ideas plaese?

Thank you, Dan.

haneefm [Syncfusion]
Replied On June 21, 2007 02:08 PM

Hi Dan,

Thank you for your update.

I am not sure of what be might be causing this strange behavior without a working sample. Is it possible for you to upload us a minimal sample to reproduce the issue here? This will help us to analyse the issue further.

Best regards,
Haneef

Daniel Dusek
Replied On June 22, 2007 06:47 AM

Hi Haneef,
I do not use the Syncfusion Hierarchical Grid it self, but I work with a wrapper. The wrapper allows to use the grid control within a managed c++ project.

I have found, that the wrapper is responsible for this behaviour. Another developer before me has chnaged the code of the wrapper somehow :-(.

Thank you for your help. I will now focus on the wrapper code, hopefully I can find the source of the behaviour there.

Regads Dan.

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.

;