0

使用:Delphi XE、Devexpress VCL。

在单元格单击事件中,我试图更改 Devexpress 的 QuantumGrid VCL 控件中超链接列中单元格的值。该列是自定义列,未绑定到数据集。

超链接列的属性设置如下:

编辑:=假;
只读 := True;
单次点击:=真;

以下代码(grdReprint 为网格的 DBTableView,grdReprintColumn2 为 Hyperlink 列)无效:

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;

如果上述方法不是更改单元格中文本的正确方法,那么欢迎其他想法。

TIA。

4

1 回答 1

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.

于 2011-09-26T01:24:13.560 回答