发卡界面如果输入姓名出错,焦点要回到姓名栏。

lynnidea 2012-01-12 12:53:55
发卡界面如果输入姓名出错,焦点要回到姓名栏。

数据窗口中改了某一项,焦点离开后,itemchanged发现刚才改的那一项的数据不合理,焦点要回去刚才的那个项上,怎么改?
...全文
135 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
eviler 2012-01-13
  • 打赏
  • 举报
回复
这么些人回答 , 用个post 能死啊

fm20027 2012-01-13
  • 打赏
  • 举报
回复
你首先是要判断输入的信息是否对,如果对则接受,如果不对,则焦点还留在原地。是这样的要求吗?
可以在dw的itemchanged事件中写脚本:
if dwo.name = '姓名' then
//判断语句
if ... then
return 0 //接受数据
else
return 1 //拒绝数据不允许焦点改变
end if
end if
ribut9225 2012-01-13
  • 打赏
  • 举报
回复
我一般在保存数据之前,才检查数据的正确性,如果数据不符合要求,会有一个提示,然后请用户修改
wag_enu 2012-01-13
  • 打赏
  • 举报
回复
[Quote=引用 9 楼 eviler 的回复:]
这么些人回答 , 用个post 能死啊


[/Quote]

........
rocketstarlin 2012-01-12
  • 打赏
  • 举报
回复
我是楼主,
Choose Case Lower(dwo.name)
Case 'event_nm'
this.setfocus()
this.setcolumn("event_nm")
end choose
2楼是我写的,但不能实现,按了tab键后,焦点已经到其他列项上了。
rocketstarlin 2012-01-12
  • 打赏
  • 举报
回复
控件.setfocus()

前面“控件”这里该怎么写?
下面这样写有报错。
Choose Case Lower(dwo.name)
Case 'event_nm'
dw_1.object.event_nm.setfocus()
end choose
wixinyoyo 2012-01-12
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 lynnidea 的回复:]
datawindow控件下的itemchanged事件:
Choose Case Lower(dwo.name)
Case 'event_nm'
this.setfocus()
this.setcolumn("event_nm")
end choose

如果修改了event_nm字段的值后,焦点改变后(如按了一下tab键)后,相把焦点返回到event_nm这个输入字段上,上面的写法……
[/Quote]


正解。。。
hchjjun 2012-01-12
  • 打赏
  • 举报
回复
控件.setfocus()
lynnidea 2012-01-12
  • 打赏
  • 举报
回复
datawindow控件下的itemchanged事件:
Choose Case Lower(dwo.name)
Case 'event_nm'
this.setfocus()
this.setcolumn("event_nm")
end choose

如果修改了event_nm字段的值后,焦点改变后(如按了一下tab键)后,相把焦点返回到event_nm这个输入字段上,上面的写法不能实现。该怎么写好?
sybasebbs 2012-01-12
  • 打赏
  • 举报
回复
Description

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.

1,075

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 相关问题讨论
社区管理员
  • 基础类社区
  • WorldMobile
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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