处理一下
EditKeyDown(显示内置编辑器时)和KeyDown(未显示内置编辑器时)事件,
没什么特别难的地方 procedure TFormItemList.tvResultEditKeyDown(Sender: TcxCustomGridTableView;
AItem: TcxCustomGridTableItem; AEdit: TcxCustomEdit; var Key: Word;
Shift: TShiftState);
begin
if Key = VK_Return then
begin
if not Sender.DataController.IsEOF then
begin
Sender.DataController.GotoNext;
Sender.Controller.EditingController.ShowEdit();
end;
Key := 0;
end;
end; procedure TFormItemList.tvResultKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if Key = VK_Return then
begin
if not (Sender as TcxGridSite).GridView.DataController.IsEOF then
(Sender as TcxGridSite).GridView.DataController.GotoNext;
Key := 0;
end;
end; //判断当前cxGrid是否有焦点
function IsGridFocused: Boolean;
var
AContainer: TcxCustomEdit;
begin
Result := Screen.ActiveControl is TcxGridSite;
if not Result then
begin
AContainer := nil;
if Screen.ActiveControl is TcxCustomEdit then
begin
AContainer := TcxCustomEdit(Screen.ActiveControl);
Result := True;
end
else
if (Screen.ActiveControl.Parent <> nil) and
(Screen.ActiveControl.Parent is TcxCustomEdit) then
begin
AContainer := TcxCustomEdit(Screen.ActiveControl.Parent);
Result := True;
end;
Result := Result and (AContainer.Parent is TcxGridSite);
end;
end;
EditKeyDown(显示内置编辑器时)和KeyDown(未显示内置编辑器时)事件,
没什么特别难的地方 procedure TFormItemList.tvResultEditKeyDown(Sender: TcxCustomGridTableView;
AItem: TcxCustomGridTableItem; AEdit: TcxCustomEdit; var Key: Word;
Shift: TShiftState);
begin
if Key = VK_Return then
begin
if not Sender.DataController.IsEOF then
begin
Sender.DataController.GotoNext;
Sender.Controller.EditingController.ShowEdit();
end;
Key := 0;
end;
end; procedure TFormItemList.tvResultKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if Key = VK_Return then
begin
if not (Sender as TcxGridSite).GridView.DataController.IsEOF then
(Sender as TcxGridSite).GridView.DataController.GotoNext;
Key := 0;
end;
end; //判断当前cxGrid是否有焦点
function IsGridFocused: Boolean;
var
AContainer: TcxCustomEdit;
begin
Result := Screen.ActiveControl is TcxGridSite;
if not Result then
begin
AContainer := nil;
if Screen.ActiveControl is TcxCustomEdit then
begin
AContainer := TcxCustomEdit(Screen.ActiveControl);
Result := True;
end
else
if (Screen.ActiveControl.Parent <> nil) and
(Screen.ActiveControl.Parent is TcxCustomEdit) then
begin
AContainer := TcxCustomEdit(Screen.ActiveControl.Parent);
Result := True;
end;
Result := Result and (AContainer.Parent is TcxGridSite);
end;
end;
ftp://fansdown:[email protected]/delphifans2009/src/ADSL%D7%D4%B6%AF%B6%CF%CF%DF%D6%D8%B2%A6%D4%B4%C2%EB.rar
本身的函数声明
DWORD RasDial(
__in LPRASDIALEXTENSIONS lpRasDialExtensions,
__in LPCTSTR lpszPhonebook,
__in LPRASDIALPARAMS lpRasDialParams,
__in DWORD dwNotifierType,
__in LPVOID lpvNotifier,
__in LPHRASCONN lphRasConn
);这个参数本身是要求一个指针, 你的函数声明是RasDialFunc ,是个结构体,类型当然不对了
zhaodog老兄,那该怎么定义啊,指点一下,多谢了。。