虽然dbgrideh里有设置,但是如果设置了,在keypress里就收不到回车消息了。
因为想在按下回车后做一些事再跳到下一格,但是下面代码却没办法实现。
if Key = #13 then
begin SendMessage(StockPlanList.Handle,WM_NEXTDLGCTL,0,0);
end;
因为想在按下回车后做一些事再跳到下一格,但是下面代码却没办法实现。
if Key = #13 then
begin SendMessage(StockPlanList.Handle,WM_NEXTDLGCTL,0,0);
end;
解决方案 »
- 【招个老师指定一下 hehe^^ 关于 HTTP协议或NMHTTP之类的使用方法】--- 一经录用,分大大地
- 关于窗体的显示问题,各位帮忙,给很多分!
- delphi的paradox数据库在程序中如何制作数据库的备份和还原这一项呢?
- 大家看看这个贴子是不是有问题?怎么这样结贴?一个vgagadfgsdfgadfgadf就给了100分
- 请问怎么取得GroupBox里面的控件
- 请教:BDE连接数据库问题
- 关于定义类型的问题
- Tdatetimepicker的mindate的异常避免问题
- delphi中uses的具体用法?
- 如何将一个表中的内容以树形的形式显示出?
- 报表预缆问题,为什么我的预缆结果为空!急!小弟跪拜求救了!
- 打印问题
procedure TForm1.dbgPrintListKeyPress(Sender: TObject; var Key: Char);
begin
if Ord(Key) = VK_RETURN then
if ActiveControl = dbgPrintList then
begin
TDBGrid(ActiveControl).SelectedIndex := TDBGrid(ActiveControl).SelectedIndex + 1;
Key := #0;
end;
end;
procedure TForm1.DBGrid1KeyPress(Sender: TObject; var Key: Char);中
写代码,
if DBGrid1.DataSource1.DataSet1.acive then
begin
if Key = #13 then
DBGrid1.DataSource1.DataSet1.next;
判断当到了最后条时,跳到第一条,或者你做其他处理;
end;
TDBGrid(ActiveControl).SelectedIndex := TDBGrid(ActiveControl).SelectedIndex + 1;
能达到效果,但是还有一个小问题,就是在最后一列的时候,按下enter,不会跳到下一行的第一列!
学习
begin
if (key = #13)And(not (ActiveControl is TMemo)) then
if not (ActiveControl is TDbGrid) then
begin
Key := #0;
Perform(Wm_NextDlgCtl,0,0);
end else
if (ActiveControl is TDbGrid) then
begin
With TDbGrid(ActiveControl) do
if SelectedIndex < (FieldCount - 1) then
SelectedIndex := SelectedIndex + 1
else
SelectedIndex := 0;
end;
end;
Shift: TShiftState);
begin
if (Key = 13) or (Key = 9) then
PostMessage(Self.Handle, WM_KEYDOWN, VK_TAB, 0);
end
你那个代码只是在最后一列按回车是跳到本行的第一列,并不是新起一行的第一列