const
GRID_EVENT_CELLCLICK = WM_USER + 1000;
type
TForm1 = class(TForm)
..
private
procedure CellClickMessage(var Message: TMessage); message GRID_EVENT_CELLCLICK;
end;
procedure TForm1.<GridTableView>CellClick(
Sender: TcxCustomGridTableView;
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
AShift: TShiftState; var AHandled: Boolean);
begin
Sender.OnCellClick := nil;
TThread.CreateAnonymousThread(
procedure
begin
if (Sender.DataController.FocusedRecordIndex < 0) or
(Sender.DataController.RecordCount = 0)
then begin
Sender.OnCellClick := <GridTableView>CellClick;
Exit;
end;
PostMessage(
Self.Handle,
GRID_EVENT_CELLCLICK,
ACellViewInfo.Item.Index,
Sender.DataController.FocusedRecordIndex
);
end);
end;
procedure TForm1.CellClickMessage(var Message: TMessage);
begin
try
if (Message.WParam < 0) or //Col Index
(Message.LParam <= 0) //Row Index
then
Exit;
//Todo
..
finally
<GridTableView>.OnCellClick := <GridTableView>CellClick;
end;
end;
반응형