AdvStringGrid calls AnchorClick instead of ControlClick

In a cell of a AdvStringGrid I use

˂CONTROL TYPE="BUTTON" WIDTH="140" VALUE="Test-Button" ID="BTN1"˃
˂CONTROL TYPE="CHECK" WIDTH="15" ID="CK1"˃
˂CONTROL TYPE="EDIT" WIDTH="120" VALUE="" ID="ED1" MAXLEN="20"˃

In another cell I use

MyLink / ˂a href=’…’˃My Link˂/a˃

In both cases AdvStringGrid1AnchorClick is called, which is NOT correct in my eyes.

I would expect that in the first case AdvStringGrid1ControlClickand/or AdvStringGrid1ControlEditDone should be called. But unfortunately it isn’t.

What has to be done so that I can distinguish between the two cases and get the other events called?

Hint: Be careful. In this post I had to exchange the HTML specific Chars < and > by Unicode-Alternatives ˂ and ˃ because otherwise it would be displayed wrong here in the forum!

Hi,

The responsible developer is currently out of office and will look into this asap. When you are posting code snippets, you can add them via the code tag:

When will the responsible developer be back in office?
I need support for this problem.

Thursday, this week.

When the control is not in an editable cell, these are considered static and not reacting as a control.
Enable editing (goEditing = true in grid.Options) or enable it for the cell that has HTML with controls that should be active with OnCanEditCell.

How can I enable editing for only one cell?
AdvStringGrid1.Cells[iCol, iRow] has no property OnCanEditCell.

I don’t want to enable edit for the whole grid.

Is there a possibility to enable edit only for cells that contain HTML controls?

OnCanEditCell has params ACol, ARow you can use to control which cell can be edited or not.

i.e.

procedure TForm1.AdvStringGrid1CanEditCell(Sender: TObject; ARow, ACol: Integer;
var CanEdit: Boolean);
begin
CanEdit := (ARow = R) and (ACol = C);
end;

Thanks, this worked.

But I still have some issues with these controls…
When defining a text field (˂CONTROL TYPE="EDIT" WIDTH="120" VALUE="" ID="ED1" MAXLEN="20"˃) I can enter text and now it fires AdvStringGrid1ControlEditDone. But after this event it deletes the text out of the input field.

Same happens to a checkbox. It will never be checked (but the event fires correct now).

I cannot reproduce a problem.
Test code for default TAdvStringGrid:

procedure TForm1.AdvStringGrid1CanEditCell(Sender: TObject; ARow, ACol: Integer;
var CanEdit: Boolean);
begin
CanEdit := (ACol = 1) and (ARow = 1);
end;

procedure TForm1.AdvStringGrid1ControlEditDone(Sender: TObject; ARow,
ACol: Integer; CtrlID, CtrlType, CtrlVal: string);
begin
AdvStringGrid1.Cells[2,ARow] := CtrlID;
AdvStringGrid1.Cells[3,ARow] := CtrlVal;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
AdvStringGrid1.DefaultRowHeight := 32;
AdvStringGrid1.DefaultColWidth := 128;
AdvStringGrid1.Cells[1,1] := '';
end;

htmlcontrols