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. (Last updated on : November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Grid editing/selection/Keypress Issues

Thread ID:

Created:

Updated:

Platform:

Replies:

6536 Aug 15,2003 01:43 PM UTC Mar 9,2004 01:25 PM UTC WinForms 3
loading
Tags: GridControl
Blaine Anderson
Asked On August 15, 2003 01:43 PM UTC

I want to use a Grid as a simple editor for Key-Value pairs. The grid has 2 columns. The first column is read-only and holds the key. The second col is editable and holds the value. Here is the behaviour I want: 1. When the grid is shown, I want the the first value (row 0, col 1) to be focused, in edit mode and all text "selected". 2. I want the Tab key to move me to the next value (row 1, col 1) and for it to be in edit mode and all text selected, etc. I have tried several things and run into some problems. For #1, I assumed that the following would work but it didn't: gridControl1.Focus(); gridControl1.CurrentCell.MoveTo(0,1); gridControl1.CurrentCell.BeginEdit(); The "editing cursor" fails to show up although apparently the current cell is set correctly because if I type a key then it replaces the text in the cell. Regarding #2, I have tried handling both "CurrentCellKeyPress" AND/OR "gridControl1_CurrentCellKeyDown" but neither one of them get called when the TAB key is pressed and the cell is in "IsEditing" mode. Other keys such as characters and BackSpace do fire the events, however. Any help would be appreciated. Blaine Anderson ComFrame Software

Administrator [Syncfusion]
Replied On August 15, 2003 03:16 PM UTC

Blaine, Here is the code snippet that I think will do what you wanted to do. Please, make sure you enable the colunm before you set it to read only. this.gridControl1.EnterKeyBehavior = GridDirectionType.Down; this.gridControl1.ColStyles[1].Enabled = false; this.gridControl1.Model.Options.WrapCellBehavior = GridWrapCellBehavior.WrapRow; this.gridControl1.ColStyles[1].ReadOnly = true; this.gridControl1.ActivateCurrentCellBehavior = GridCellActivateAction.SelectAll; this.gridControl1.ForceCurrentCellMoveTo = true; this.gridControl1.CurrentCell.MoveTo(1,2); Regards, Priti

Michael Mann
Replied On March 9, 2004 12:12 PM UTC

Hi, I have similar problems. I try to add a row, set the focus and begin editing in the current cell. my code snippet looks like this: private void button1_Click(object sender, System.EventArgs e) { int row = ++gridControl1.RowCount; gridControl1[row, 1].CellType = "TextBox"; gridControl1[row, 1].CellValue = "in edit"; this.gridControl1.EnterKeyBehavior = GridDirectionType.Down; this.gridControl1.Model.Options.WrapCellBehavior = GridWrapCellBehavior.WrapRow; this.gridControl1.ActivateCurrentCellBehavior = GridCellActivateAction.ClickOnCell; this.gridControl1.ForceCurrentCellMoveTo = true; this.gridControl1.CurrentCell.MoveTo(row, 1); gridControl1.CurrentCell.BeginEdit(); } Can anyone provide a code snippet, that actually starts editing in the cell? Thanks in advance Michael Mann

Administrator [Syncfusion]
Replied On March 9, 2004 01:25 PM UTC

Try setting gridControl1.Focus() as clicking a button will remove the focus from the grid, and the grid must have focus in order to set a cell to be editing.

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.

Warning Icon 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.Close Icon

;