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.

Keeping CurrentCell active after an ENTER pressed

Thread ID:

Created:

Updated:

Platform:

Replies:

24460 Feb 4,2005 07:10 AM Feb 16,2005 05:29 AM Windows Forms 11
loading
Tags: Grouping
Jason Hales
Asked On February 4, 2005 07:10 AM

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

Administrator [Syncfusion]
Replied On February 4, 2005 10:00 AM

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

Jason Hales
Replied On February 7, 2005 06:04 AM

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

Jason Hales
Replied On February 8, 2005 07:23 AM

...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

Administrator [Syncfusion]
Replied On February 8, 2005 11:42 AM

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

Jason Hales
Replied On February 9, 2005 05:00 AM

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 >

Jason Hales
Replied On February 9, 2005 09:17 AM

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

Administrator [Syncfusion]
Replied On February 11, 2005 12:45 PM

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

Administrator [Syncfusion]
Replied On February 11, 2005 03:50 PM

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

Jason Hales
Replied On February 15, 2005 09:21 AM

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

Administrator [Syncfusion]
Replied On February 15, 2005 11:48 AM

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

Jason Hales
Replied On February 16, 2005 05:29 AM

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

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.

;