Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/Database/Data Aware Controls/TDBGrid    [ Add a report in this area ]  
Report #:  89047   Status: Closed
TDBGrid placed on a TCustomForm descendant cannot be focused properly
Project:  Delphi Build #:  2010, XE
Version:    15.1 Submitted By:   Serge (Developer Express Support)
Report Type:  Basic functionality failure Date Reported:  10/18/2010 4:06:00 AM
Severity:    Commonly encountered problem Last Updated: 6/17/2013 6:05:32 PM
Platform:    All platforms Internal Tracking #:   18400
Resolution: Cannot Reproduce (Resolution Comments) Resolved in Build: : XE4 Update1
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: 10
The standard grid's implementation does not allow properly focusing it when the grid is placed onto a form that is not a TForm descendant:

function TCustomGrid.IsActiveControl: Boolean;
Result := (ParentForm.ActiveControl = Self) and
      ((ParentForm = Screen.ActiveForm) or (ParentForm is TCustomActiveForm) or (ParentForm is TCustomDockForm))

Added by Sysop
This issue still exists in Delphi XE(w/ Update1).
Steps to Reproduce:
Open the attached project and click the "Test" button. Then, try to focus the grid.

Tomohiro Takahashi at 10/18/2010 7:55:27 PM -
> [Description]
> TDBGrid placed on a TCustomForm descendant cannot be focused properly
> ...
> [Steps]
> Then, try to focus the grid.
Could you tell us more detail about the result to verify your issue?
- Expected behavior:
- Actual behavior:

Serge (Developer Express Support) at 1/4/2011 8:40:24 AM -
Expected behavior: DBGrid should allow editing data
Actual behavior:  DBGrid does not allow editing data

In our test sample, while DBGrid is placed on the main form you can edit its data. However, when you press the "Test" button, we change Grid's parent. Then, it is impossible to edit data.

Luis Branca at 11/7/2012 9:08:47 AM -
This has been spotted again on

Tomohiro Takahashi at 6/17/2013 6:05:44 PM -
This issue is not reproducible with XE4 Update1.

Server Response from: ETNACODE01