TEditLink in TAdvStringGrid change of cell

Hello,
I used a TPlannerDatePicker with TEditLink in TAdvStringGrid.
I have a problem with the TPlannerDatePicker, its value is display on the next cell I click on.
I use OnGetEditorType and in this event I have this :

procedure Tffichecontrat.sgLeavesGetEditorType(Sender: TObject; ACol, ARow: Integer; var AEditor: TEditorType);
begin
   if (ACol=CLEAVE_DAYSEARNED) or (ACol=CLEAVE_BALANCE) then
   begin
	  AEditor := edFloatSpinEdit;
   end else if ACol=CLEAVE_DATE then
   begin
	  AEditor := edCustom;
	  sgLeaves.EditLink := FPlannerEdit;
   end;
end;

My TPlannerCalendarEditLink (Inherits from TEditLink) implements OnEditExit (HideEditor), GetEditControl, GetEditorValue, SetEditorValue.

When I click in a cell with my TPlannerCalendarEditLink, all is OK.
Click in DateCell
But when I click on an another cell, in the same column or not, I have the content of the TPlannerCalendarEditLink in the new cell.
Click in SpinCell

I think that I have miss something, I try many solutions but it doesn't work.
Have you a solution for this.

Thanks

Can you please create a sample source test project with which we can reproduce this here? Without seeing all code involved and all property settings involved, it is very hard to guess what might be going wrong here.

Hello Bruno,

You will find attached a sample project where the problem are.
EditLink_AdvStringGrid.zip (6.9 KB)

To reproduce, go in one cell of the "Date" column. Click in it to have the editor display. Then click in another cell, at this cell, the content display is the content of the date editor.

Thank you.

I retested this with the latest TMS VCL UI Pack v10.4.3.0 and I cannot reproduce an issue.
Can you please make sure you use the latest version of the components?

Thanks for your response.
I have installed the latest VCL UI Pack the October 3rd. But I still have this issue (The issue is already here before the update).

My dev environment :
Win 10 Pro 64 Bits
Delphi 10.2.3

I see your code in your TPlannerCalendarEditLink is not complete.

Please change this code to:

procedure TPlannerCalendarEditLink.EditExit(Sender: TObject);
var
  pt: TPoint;
  grid: TAdvStringGrid;
begin
  grid := (GetParent as TAdvStringGrid);

  grid.HideInplaceEdit;
  FEdit.Hide;

  GetCursorPos(pt);

  pt := grid.ScreenToClient(pt);

  if PtInRect(grid.ClientRect,pt) then
  begin
    if grid.CanFocus then
      grid.SetFocus;
  end;
end;

Thank you Bruno.
Your solution is working perfectly.

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.