Focus After Custom Inplace Editor

Sorry for the imprecise Subject on this post as I did not know quite how to describe the issue in a few words. The problem is that after editing a cell containing a custom inplace editor based on a TEdit connected to a TFormControlEditLink, an extra mouse click is required to activate other controls. This problem can be demonstrated by dropping a TAdvstringgrid, a tedit, a tbitbtn amd a TFormControlEditLink on a Form. Enable editing in the grid and set up OnGetEditortype as shown below. After editing a cell, click on the close button and nothing happens. Click the close button a second time and the button works as expected.

Is there some option that I haven't set or something else that I have done wrong?

Thank you! 

unit Unit5;


  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
  System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Buttons, AdvGrid,
  frmctrllink, Vcl.ExtCtrls, Vcl.Grids, AdvObj, BaseGrid;

  TForm5 = class(TForm)
    AdvStringGrid1: TAdvStringGrid;
    FormControlEditLink1: TFormControlEditLink;
    BitBtn1: TBitBtn;
    Edit1: TEdit;
    procedure BitBtn1Click(Sender: TObject);
    procedure AdvStringGrid1GetEditorType(Sender: TObject; ACol, ARow: Integer;
      var AEditor: TEditorType);
    { Private declarations }
    { Public declarations }

  Form5: TForm5;


{$R *.dfm}

procedure TForm5.AdvStringGrid1GetEditorType(Sender: TObject;
  ACol, ARow: Integer; var AEditor: TEditorType);
  AEditor := edCustom;
  FormControlEditLink1.Control := Edit1;
  AdvStringGrid1.EditLink := FormControlEditLink1;

procedure TForm5.BitBtn1Click(Sender: TObject);


We have traced & solved this issue. The next update will address this.

Thank you for the quick resolution!


I thought this fix would be in the 8-12-2014 update (advstringgrid  but I updated to the latest version of advstringgrid and the problem described above remains. Can you put the fix in the next release?
Thank you

I cannot reproduce this with the latest version of TAdvStringGrid.
Test project:


Thank you for the rapid response. I am baffled because I still get the issue with the latest version, I downloaded your file, compiled and still had the problem.

 To demonstrate this to you I downloaded your source, made a few changes, compiled it and made it available to you at

Note I included a compiled version that shows the version of advstringgrid and it matches the latest release. The instructions on the main form will walk you through how to reproduce the issue. Specifically, when you edit column 1, which contains an inplace editor, the behavior losing focus differs from column 2, with the default editor.

Thank you for your assistance.

I opened & compiled your project here again, but the conclusion here is the same. It works as expected. It was tested on Win7 64bit.

Did you test our EXE?


The zip file in your message does not contain an EXE compiled by you so I have not been able test your exe.

My zip (above) contains an EXE I complied under Delphi XE2 Update 4, Win32. Have you tried my EXE?

You can download your compiled test app here:

We cannot see a problem. The click on the button always closes the form immediately.


Agreed that your version works -- and I believe yours works because you appear to be using a newer version of the Grid that differs from what is being distributed. When I run your example, the version number for the grid is displayed in the test program as, August 2014. When I compile on my machine, the version is, August 2014. The version I am using, ", August 2014", is the version that was installed by the Subscription Manager this past Sunday (8/17).. 

You have not commented on whether you have downloaded and run my complied version of the test program. If you do so, you should be able to see that it returns ", August 2014" -- demonstrating that the version that you currently distribute differs from the one you are using when you test. 

Could you please give me access to

We aim to release an update tomorrow.


I downloaded the new version that was released today. I know that it must seem as though I am doing something wrong, but the problem persists. I wonder if there is some difference between XE6 vs. XE2 that is causing the problem -- I am using XE2 64-bit. I tried to test this possibility myself by downloading the trial version of XE6 but I could not install TMS components because the trial version of XE6 does not include the command line compiler.

Would you please test under XE2? Again, I know it works in XE6, but under XE2 I can;'t get it to work.

Thank you!

I especially recompiled this test app now with XE2 but cannot see any difference in behavior. 


The problem persists. I even did the following:
1. Installed Delphi XE2 and TMS Component Pack (using the Subscription Manager) onto a PC that has never previously been used for programming of any sort -- so it should be a really clean environment.
2. Compiled the test program on that machine and the problem was identical to when I compile on my normal development machine.

In my prior posts I have asked you to try MY compiled program to confirm that you can see that when compiled on several of my machines, and with the currently released version, the problem occurs. The following zip contains an EXE compiled on my machine. Please test it and confirm that you see the problem.

If anyone else is reading this thread, could you please try downloading this and compiling the test program and see if you get the error and then post the result here?

For security reasons, we can't run here just any downloaded EXE here.

Looking at the size of your EXE, ours is 3.648.512 bytes and yours 3.854.848 bytes.
We compile with default Delphi XE2 compiler settings. Are you also compiling with default settings?

Bruno Fierens2014-08-25 11:48:17