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.

GridCurrencyCell and ActivateCurrentCellBehavior (v 2.0)

Thread ID:

Created:

Updated:

Platform:

Replies:

10159 Jan 23,2004 07:54 AM Jan 23,2004 10:34 AM Windows Forms 2
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On January 23, 2004 07:54 AM

I created my own GridCurrencyCell, but I''m having trouble with the ActiveCurrentCellBehavior. Attached is a small example, using my CustomCurrencyCell. I want to accomplish the same behavior as in the TextBox cell (1st column) so when the user start typing the cell will enter in Edit Mode (2nd column). TIA Jose. Combo2_7454.zip

Administrator [Syncfusion]
Replied On January 23, 2004 08:44 AM

I think you need to override OnKeyDown in the renderer class and activate the cell there if it is not already active. Below is a try at this.
protected override void OnKeyPress(KeyPressEventArgs e)  
{
	bool controlKeyDown = (Control.ModifierKeys & Keys.Control) != Keys.None;
	bool menuKeyDown = (Control.ModifierKeys & Keys.Alt) != Keys.None;
	if (!e.Handled && !controlKeyDown && !menuKeyDown)
	{
		if (!Char.IsControl(e.KeyChar) 
			&& !IsReadOnly()        // cell is not readonly
			&& SupportsFocusControl)    // OnStartEditing notification returns true
		{
			if (!CurrentCell.HasControlFocus )
			{
				if (this.ValidateString(e.KeyChar.ToString())
					&& CurrentCell.BeginEdit())
				{
					CurrentCell.HasControlFocus = true;
					if (this.NotifyCurrentCellChanging())
					{
						CurrentCell.IsModified = true;
						CurrencyTextBox.Text = e.KeyChar.ToString();
						CurrencyTextBox.SelectionStart = 1;
						CurrencyTextBox.SelectionLength = 0;
					}
				}
				e.Handled = true;
			}
		}
	}
	base.OnKeyPress(e);
}

Administrator [Syncfusion]
Replied On January 23, 2004 10:34 AM

Just what I wanted. Thanks!!!

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.

;