你首先是要判断输入的信息是否对,如果对则接受,如果不对,则焦点还留在原地。是这样的要求吗?
可以在dw的itemchanged事件中写脚本:
if dwo.name = '姓名' then
//判断语句
if ... then
return 0 //接受数据
else
return 1 //拒绝数据不允许焦点改变
end if
end if
[Quote=引用 2 楼 lynnidea 的回复:]
datawindow控件下的itemchanged事件:
Choose Case Lower(dwo.name)
Case 'event_nm'
this.setfocus()
this.setcolumn("event_nm")
end choose
Sets the focus on the specified object or control.
Controls
Any object
Syntax
objectname.SetFocus ( )
Argument Description
objectname The name of the object or control in which you want to set the focus
Return value
Integer. Returns 1 if it succeeds and -1 if an error occurs. If objectname is null, SetFocus returns null.
Usage
If objectname is a ListBox, SetFocus displays the focus rectangle around the first item. If objectname is a DropDownListBox, SetFocus highlights the edit box. To select an item in a ListBox or DropDownListBox, use SelectItem.
Drawing objects cannot have focus. Therefore, you cannot use SetFocus to set focus to in a Line, Oval, Rectangle, or RoundRectangle.