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. Image for the cookie policy date
close icon

Keeping CurrentCell active after an ENTER pressed

Hi all, I''m using v3 of Grouping Grid and setting: grid.TableModel.Options.ActivateCurrentCellBehavior = GridCellActivateAction.SelectAll; grid.TableModel.Options.EnterKeyBehavior = GridDirectionType.None; The problem is that if a user enters a value, and presses ENTER the current cell seems to lose focus My users would like to press ENTER and then enter another new value if required into the same cell - at the moment they have to click again on the cell or grid background to get the current cell active FYI I''m inside a RecordValueChangingEventHandler delegate when I alter the value they have entered if I need to As ever, any help would be much appreciated Jason

11 Replies

AD Administrator Syncfusion Team February 4, 2005 03:00 PM UTC

Jason, In your form call this.groupingGrid1.TableControl.WantEnterKey = false; and then override protected override bool ProcessDialogKey(Keys keyData) { if (keyData == Keys.Enter) { GridCurrentCell cc = this.groupingGrid1.TableControl.CurrentCell; cc = cc.Renderer.GetNestedCurrentCell(); cc.ConfirmChanges(); cc.Lock(); ((GridTableControl) cc.Grid).Table.CurrentRecordManager.EndEdit(); cc.Unlock(); } return base.ProcessDialogKey (keyData); } Stefan


JH Jason Hales February 7, 2005 11:04 AM UTC

Hi Stefan, thanks for that. It now works exactly as I need; :-)


JH Jason Hales February 8, 2005 12:23 PM UTC

...well it kind of works, except that in my RecordValueChanging event handler I actually alter the entered value a little (some internal rounding rules) - setting e.NewValue(RecordValueChangingEventArgs) The trouble is my NewValue is not being shown - the entered value is still being shown and highlighted TIA Jason


AD Administrator Syncfusion Team February 8, 2005 04:42 PM UTC

Try calling cc.Refresh() after cc.Unlock(). The Lock / Unlock blocks any changes to the active current cell. Stefan


JH Jason Hales February 9, 2005 10:00 AM UTC

I''ll just requoute myself "It now works exactly as I need; :-)". Excellent support. Thanks for that Jason >Try calling cc.Refresh() after cc.Unlock(). > >The Lock / Unlock blocks any changes to the active current cell. > >Stefan >


JH Jason Hales February 9, 2005 02:17 PM UTC

Oops, I forgot to return true for ENTER key and was getting a Beep due to the TextBox being single line. All working now though


AD Administrator Syncfusion Team February 11, 2005 05:45 PM UTC

I tried this, and realized there is a small glitch... I type a value into a cell, and press enter. The value updates and is selected. However, when I click on a column header to resort, the value that I just entered appears in the same position on the screen, but in the wrong cell... it is in the cell that has resorted to that position. Navigating out of the cell removes the stray value, but this certainly looks strange. the cell that should have gotten the value does, that is unaffected. seems like this is some sort of a refresh issue. Any ideas? Thanks, Brian


AD Administrator Syncfusion Team February 11, 2005 08:50 PM UTC

If you use Lock / Unlock this will block any changes to the active current cell - even sorting. That''s why you have to manually navigate out of the cell in such case. Stefan >I tried this, and realized there is a small glitch... I type a value into a cell, and press enter. The value updates and is selected. However, when I click on a column header to resort, the value that I just entered appears in the same position on the screen, but in the wrong cell... it is in the cell that has resorted to that position. Navigating out of the cell removes the stray value, but this certainly looks strange. > >the cell that should have gotten the value does, that is unaffected. seems like this is some sort of a refresh issue. > >Any ideas? >Thanks, >Brian


JH Jason Hales February 15, 2005 02:21 PM UTC

Brian and I are working on the same thing but it doesn''t seem to be related to the ProcessDialogKey changes detailed here (as I commented out the code and it''s still the same) I''ll just repeat the behaviour we are seeing - although this doesn''t happen to the standard grouping grid - we are very heavily cusotmisng the gird and imagine it''s an option we''ve set somewere 1. Select a cell, say Row/Col 2,3. 2 Enter a value into a cell. Press enter. The current cell is still higlighted -at 2/3 2. Click on a header cell 3. The grid re-sorts, yet the cell (2/3) is shown with the value just entered, and has focus The the cell in the new row postion is also highlighted Any ideas? > >If you use Lock / Unlock this will block any changes to the active current cell - even sorting. That''s why you have to manually navigate out of the cell in such case. > >Stefan > > >>I tried this, and realized there is a small glitch... I type a value into a cell, and press enter. The value updates and is selected. However, when I click on a column header to resort, the value that I just entered appears in the same position on the screen, but in the wrong cell... it is in the cell that has resorted to that position. Navigating out of the cell removes the stray value, but this certainly looks strange. >> >>the cell that should have gotten the value does, that is unaffected. seems like this is some sort of a refresh issue. >> >>Any ideas? >>Thanks, >>Brian


AD Administrator Syncfusion Team February 15, 2005 04:48 PM UTC

When the user clicks on a header a cell a QueryAllowSortColumn event is raised. In that event you could try and deactivate the current cell (or end edit mode) with groupingGrid.TableControl.CurrentCell.Deactivate() Stefan >Brian and I are working on the same thing but it doesn''t seem to be related to the ProcessDialogKey changes detailed here (as I commented out the code and it''s still the same) > >I''ll just repeat the behaviour we are seeing - although this doesn''t happen to the standard grouping grid - we are very heavily cusotmisng the gird and imagine it''s an option we''ve set somewere > >1. Select a cell, say Row/Col 2,3. > >2 Enter a value into a cell. Press enter. The current cell is still higlighted -at 2/3 > >2. Click on a header cell > >3. The grid re-sorts, yet the cell (2/3) is shown with the value just entered, and has focus The the cell in the new row postion is also highlighted > >Any ideas? >> >>If you use Lock / Unlock this will block any changes to the active current cell - even sorting. That''s why you have to manually navigate out of the cell in such case. >> >>Stefan >> >> >>>I tried this, and realized there is a small glitch... I type a value into a cell, and press enter. The value updates and is selected. However, when I click on a column header to resort, the value that I just entered appears in the same position on the screen, but in the wrong cell... it is in the cell that has resorted to that position. Navigating out of the cell removes the stray value, but this certainly looks strange. >>> >>>the cell that should have gotten the value does, that is unaffected. seems like this is some sort of a refresh issue. >>> >>>Any ideas? >>>Thanks, >>>Brian


JH Jason Hales February 16, 2005 10:29 AM UTC

Thanks Stefan. That''s fixed it but the user now has to click on the new cell to make it current - I think that''ll be OK for the time being though Jason

Loader.
Live Chat Icon For mobile
Up arrow icon