cxGrid在编辑录入的时候,如何实现按方向左右键跳到前一个单元格或后一个单元格?急!在线等(50分)

G

GoMyWay

Unregistered / Unconfirmed
GUEST, unregistred user!
各位朋友请问:cxGrid在编辑录入的时候,如何实现按方向左右键跳到前一个单元格或后一个单元格? 类似Excel或Acess
 
自己处理OnKeyPress事件不就得了
 
有没有具体的代码? 最好是cxGird 调试通过的代码
 
先CxGrid1.Setfocus;
再需要跳到哪一列,就用Gdb1FArtNo.FocusWithSelection;
 
我用了tableview.DataController.FocusControl() 方法可以移动焦点了,可是遇到更改了列的属性比例,第二列设为 dateEdit, 焦点跳上去就要报"control '' has no parent window" 错误. 怎么解决呢?
procedure TForm1.vWEditKeyDown(Sender: TcxCustomGridTableView;
AItem: TcxCustomGridTableItem;
AEdit: TcxCustomEdit;
var Key: Word;
Shift: TShiftState);
var
a: boolean;
begin
if key = vk_left then
begin
AEdit.PostEditValue;
vW.DataController.FocusControl(vW.Controller.FocusedColumn.Index-1,a);
end;

if key = vk_right then
begin
AEdit.PostEditValue;
vW.DataController.FocusControl(vW.Controller.FocusedColumn.Index+1,a);
end;
end;
 
只要将TableView的OptionsBehavior的AlwaysShowEditor设为True就可以了。
 

Similar threads

S
回复
0
查看
749
SUNSTONE的Delphi笔记
S
S
回复
0
查看
630
SUNSTONE的Delphi笔记
S
D
回复
0
查看
2K
DelphiTeacher的专栏
D
D
回复
0
查看
1K
DelphiTeacher的专栏
D
D
回复
0
查看
877
DelphiTeacher的专栏
D
顶部