0

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.

  • Your code works if you turn off the single click option. – Bob A Sep 26 '11 at 00:06
  • VOID and UNVOID don't look like something you would use a hyperlink control for. Anyway the single click option is going to act upon the editvalue as a hyperlink. – Bob A Sep 26 '11 at 00:29
  • It is the Editing=false that prevents the editvalue from being acted on as a hyperlink. Different values of SingleClick and ReadOnly seem to have no effect. Are you sure the dataset is editable? – crefird Sep 26 '11 at 01:35
  • @crefird - Ah yes, I didn't catch the editing false property setting... When Editing is true the Single Click option bypasses the CellClick event in my little test app. Thanks, I'll remove my answer. – Bob A Sep 26 '11 at 02:00
  • With Editing=False the CellClick event fires and the EditValues change as expected in my test app. – Bob A Sep 26 '11 at 02:31

1 Answers1

0

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.

Bob A
  • 346
  • 2
  • 5