请教一个简单的问题:
怎么使cxGrid1DBTableView1的onkeydown事件触发cxGrid1DBTableView1的oncellclick事件?

解决方案 »

  1.   

    最简单的做法:建立一个Action,在两个事件中,写Action.Execute;
      

  2.   

    谢谢!!能否具体一点?刚查阅了一下action的用法,还是不太懂。
      

  3.   

    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, cxGraphics, cxControls, cxLookAndFeels, cxLookAndFeelPainters,
      cxStyles, dxSkinsCore, dxSkinsDefaultPainters, dxSkinscxPCPainter,
      cxCustomData, cxFilter, cxData, cxDataStorage, cxEdit, DB, cxDBData, ActnList,
      cxGridLevel, cxClasses, cxGridCustomView, cxGridCustomTableView,
      cxGridTableView, cxGridDBTableView, cxGrid;type
      TForm1 = class(TForm)
        grdViewGrid1DBTableView1: TcxGridDBTableView;
        grdLvlGrid1Level1: TcxGridLevel;
        grd1: TcxGrid;
        actlst1: TActionList;
        act1: TAction;
        procedure act1Execute(Sender: TObject);
        procedure grdViewGrid1DBTableView1CellClick(Sender: TcxCustomGridTableView;
            ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift:
            TShiftState; var AHandled: Boolean);
        procedure grdViewGrid1DBTableView1KeyDown(Sender: TObject; var Key: Word;
            Shift: TShiftState);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}procedure TForm1.act1Execute(Sender: TObject);
    begin
      ShowMessage('Action Execute!');
    end;procedure TForm1.grdViewGrid1DBTableView1CellClick(Sender:
        TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo;
        AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
    begin
      act1.Execute;
    end;procedure TForm1.grdViewGrid1DBTableView1KeyDown(Sender: TObject; var Key:
        Word; Shift: TShiftState);
    begin
      act1.Execute;
    end;end.
      

  4.   

    对你的景仰犹如滔滔江水,绵绵不绝。教我学会用action了。