pb 当‘光标在某个文本输入框’ 可否作为if条件?要怎么写??
2个回答
推荐于2016-10-17 · 知道合伙人软件行家
关注
展开全部
用GetFocus()配合classname()
光标在文本输入框,即当前焦点在文本输入框,那只要取出当前焦点的控件名称,和文本框的名称对比就可以判断
例判断当前光标是否在sle_1上
if classname(GetFocus()) = "sle_1" then
messagebox("","光标在sle_1上")
else
messagebox("","光标不在sle_1上")
end if
追问
大神呀,谢谢了
展开全部
GraphicObject which_control
SingleLineEdit sle_which
CommandButton cb_which
string text_value
which_control = GetFocus()
CHOOSE CASE TypeOf(which_control)
CASE CommandButton!
cb_which = which_control
text_value = cb_which.Text
CASE SingleLineEdit!
sle_which = which_control
text_value = sle_which.Text
CASE ELSE
text_value = ""
END CHOOSE
SingleLineEdit sle_which
CommandButton cb_which
string text_value
which_control = GetFocus()
CHOOSE CASE TypeOf(which_control)
CASE CommandButton!
cb_which = which_control
text_value = cb_which.Text
CASE SingleLineEdit!
sle_which = which_control
text_value = sle_which.Text
CASE ELSE
text_value = ""
END CHOOSE
追问
这是什么??
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询