如何测试特定控件是否具有焦点? [英] how to test if a particular control has focus?

查看:76
本文介绍了如何测试特定控件是否具有焦点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我具有Access 2007表单,我想测试特定控件(切换按钮)是否具有焦点,

i have access 2007 form and i want to test if a particular control (toggle button) has the focus ,

类似:

if gotfocus(mytoggle) then
dosomething
endif

或者也许是这样:

if me.mytoggle.setfocus = true then
dosomething
endif

我已经搜索过,但是找不到,有人可以告诉我什么是正确的上装吗?

I have searched and cannot find this , can someone tell me what is correct top to do this ?

推荐答案

对于当前形式,这是

If (mytoggle Is Me.ActiveControl) Then

对于当前的Access.Application:

This for the current Access.Application:

If (mytoggle Is Screen.ActiveControl) Then

请注意,如果没有控件具有焦点,则* .ActiveControl可能不存在.

Be careful, if no control has focus, *.ActiveControl may not exist.

这篇关于如何测试特定控件是否具有焦点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆