50分求救cxgrid高手,我在窗体有若干个cxgrid,怎么判断当前焦点是哪个?

HelpMeNow 2010-02-04 04:51:31
同上。
我用activecontrol就是取不到
...全文
142 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
Blessed_Chuan 2010-03-18
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 avan_lau 的回复:]
Delphi(Pascal) code

function GetCxGridFocused(aControl: TWinControl): TcxCustomGrid;
begin
Result:= nil;
if aControl is TcxCustomGrid then
Result := TcxCustomGrid(aControl)
else
w……
[/Quote]
正解
金卯刀 2010-02-04
  • 打赏
  • 举报
回复

function GetCxGridFocused(aControl: TWinControl): TcxCustomGrid;
begin
Result:= nil;
if aControl is TcxCustomGrid then
Result := TcxCustomGrid(aControl)
else
while aControl.Parent<>nil do
begin
aControl:= aControl.Parent;
if aControl is TcxCustomGrid then
begin
Result:= TcxCustomGrid(aControl);
Break;
end;
end;
end;



procedure TForm1.SpeedButton1Click(Sender: TObject);
begin
Caption := GetCxGridFocused(ActiveControl).Name;
end;
lhy 2010-02-04
  • 打赏
  • 举报
回复
遍历控件,查看Focused。
kfcoffe 2010-02-04
  • 打赏
  • 举报
回复
每个cxGrid的OnEnter中判断

16,748

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 语言基础/算法/系统设计
社区管理员
  • 语言基础/算法/系统设计社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧