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;

interface

uses
  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;

type
  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
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form5: TForm5;

implementation

{$R *.dfm}

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

procedure TForm5.BitBtn1Click(Sender: TObject);
begin
  close;
end;

end.

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

Thank you for the quick resolution!

Bruno,

I thought this fix would be in the 8-12-2014 update (advstringgrid 7.4.4.2)  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: http://www.tmssoftware.net/public/formcontroleditlinkfocus.zip

Bruno,

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 http://1drv.ms/1sOT35g

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?

Bruno,

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:


http://www.tmssoftware.net/public/formctrleditlink.zip

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

Bruno,

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 7.4.4.3, August 2014. When I compile on my machine, the version is 7.4.4.2, August 2014. The version I am using, "7.4.4.2, 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 "7.4.4.2, 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 7.4.4.3?

We aim to release an update tomorrow.

Bruno,

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.


http://www.tmssoftware.net/public/formcontrolfocus.zip 

Bruno,

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. 

http://1drv.ms/1BP9wsC

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