QuantumGrid VCL - How to change the text of a Hyperlink column in the cell click event?

1.4k Views Asked by At

Using: Delphi XE, Devexpress VCL.

In the cell click event, I am trying to change the value of a cell in a hyperlink column in Devexpress's QuantumGrid VCL control. The column is a custom column and is not bound to the dataset.

The hyperlink column's properties are set as per:

Editing := False;
ReadOnly := True;
SingleClick := True;

The following code (grdReprint is the grid's DBTableView, and, grdReprintColumn2 is the Hyperlink column) is ineffective:

procedure TfReceiptList.grdReprintCellClick(Sender: TcxCustomGridTableView;
  ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
  AShift: TShiftState; var AHandled: boolean);
var
  v: integer;
  c: integer;
begin

  if ACellViewInfo.Item = grdReprintColumn1 then
  begin
    v := datamod.uspRECEIPT_LSTRECEIPTID.AsInteger;

    fMain.PrintReceipt(v);

  end
  else if ACellViewInfo.Item = grdReprintColumn2 then
  begin

    (* This code is ineffective because the cell contents do not change *)

    if ACellViewInfo.Text = 'Void' then
      grdReprint.DataController.SetEditValue(grdReprintColumn2.Index, 'Unvoid', evsValue)
    else
      grdReprint.DataController.SetEditValue(grdReprintColumn2.Index, 'Void', evsValue);

  end;
end;

If the above isn't the proper way to change the text in the cell, then other ideas are welcome.

TIA.

1

There are 1 best solutions below

0
On

When the SingleClick property in the hyperlink control is set to TRUE the GridViews CellClick event is not called.

(I may be able to further help if I could understand why you a using a hyperlink control for what looks like just text. See my coments below your question.)

EDIT: This answer is incorrect if the gridViews Editing property is False as OP indicated. It is does describe the behavior if Editing is True FWIW.