Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/FireMonkey/Components    [ Add a report in this area ]  
Report #:  103864   Status: Open
FMX.Grid navigation and EditMode broken
Project:  Delphi Build #:  16.0.4429.46931
Version:    16.4 Submitted By:   Gustav Schubert
Report Type:  Feature Specification issue Date Reported:  3/2/2012 4:42:30 AM
Severity:    Infrequently encountered problem Last Updated: 4/18/2012 2:13:29 AM
Platform:    All platforms Internal Tracking #:   27364
Resolution: None (Resolution Comments) Resolved in Build: : None
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: None
Unit FMX.Grid, Delphi XE2, Update 4

Navigation between the grid cells, entering/leaving EditMode, and navigating within the text being edited is broken.

What I want:
1. Do not automatically enter EditMode of a cell (unless user sets option).
2. Enter a cell with F2 or by starting to type (unless cell/column is readonly).
3. Then allow navigation with vkLeft and vkRight in the text being edited.
4. vkReturn or leaving the cell via vkUp/vkDown should end EditMode.
5. vkLeft and vkRight should navigate between cells again when EditMode is done.
6. Entering a cell by starting to type should replace the cell content.
7. Entering a cell by F2 should select the cell content, allowing the user to edit existing content.

Current status of the vkTab handling in the Grid:
- sometimes will select cell content, even if the row is readonly
- sometimes will select cell content of the previous (or next) editable column
- somtimes navigates off the grid control

vkTab requirements to be discussed (not implemented in workaround):

8. If F2 is pressed in a readonly column, no blinking cursor should appear (now the cell is not editable, but the carret appears)
9. Tab should navigate between cells (not now) when not in edit mode
10. Tab should end EditMode AND leave the cell (currently does end EditMode, but does not leave the cell)
11. Ctrl + vkTab only to leave Grid?

I use TCustomGrid as a 'StringGrid' together with a custom data source.
I use modified versions of TTextCell, TColumn, TCustomGrid,
and a custom implementation of IEditGridLinkObserver.

This means that the tested situation is one where
  Grid.Observers.IsObserving(TObserverMapping.EditGridLinkID) evaluates to true.
Steps to Reproduce:
Changes needed in copy of FMX.Grid to support requirements 1 - 7:

comment out line 711 and 712

711  //if (Grid <> nil) and (FEditMode = -1) then
712  //  DoEnter(Sender); <-- don't want that to happen by default

exclude vkRight and VkLeft from condition in line 723

723  if (Key = vkUp) or (Key = vkDown) { or Key = vkRight) or (Key = vkLeft) } then

comment out lines 962 and 963

962  //if not FCellControls[i].IsFocused then
963  //  lGrid.Root.SetActiveControl(FCellControls[i]); //<-- not wanted

comment out line 1632

1632 //if (Key = 0) and (Columns[ColumnIndex].InEditMode = -1) then //always do this

Tomohiro Takahashi at 3/4/2012 8:41:10 PM -
Could you please attach sample project to reproduce your issue?

Gustav Schubert at 3/7/2012 12:15:05 AM -
My workaround is compatible with the the fishfact demo in

C:\Users\Public\Documents\RAD Studio\9.0\Samples\LiveBindings\binddblink\fmx\

When testing with that project I found that the FFocus control is now always in the first column as reported in QC entries 103933 (In-place editor in TStringGrid is not drawn except the first column) and 103947 ([Regression in Update 4] FMX grids defective)

I was able to fix that by rolling back the TCustomGrid.UpdateSelection method to the Update 3 version.

Threre are other things that could be improved:

- Fix the spelling of TCustomGrid.OnEdititingDone property.
- Make more protected methods virtual

I care about how 'EditMode' is implemented.

Also I draw the 'background' of each grid cell using context specific color.
This should be possible just by overriding methods of the grid, without making a copy of its classes.

Consider sending me a preview of the next version of FMX.Grid so I can test early and give feedback.

Tomohiro Takahashi at 5/21/2012 5:43:28 PM -
This report was opened with valid Internal Tracking Number.

Server Response from: ETNACODE01