如何在数据窗口(datawindow)中用enter代替tab在字段间移动
| summary: | this document shows the pb4.0 method and pb 5.0 method of programming the enter key to tab through a datawindow. |
| document id: | 44003 | last revised: | 02/22/96 |
| topic: | datawindows | document type: | technote |
| product: | powerbuilder | version: | 5; 4 |
| platform: | pc | operating system: | not operating system specific |
programming the enter key to move between columns in a datawindow
general comments: the technique described below works fine in pb 5. the changes required are due to:
(1) setactioncode() function made obsolete in pb 5.0 - we need to use events return codes instead.
(2) pb 5.0 new syntax to access the value of attributes in dw - instead of using describe() we can referenced the attribute directly.
description: how to change the enter key to act like a tab key.
solution: to have the enter key act like a tab key, create a user event to correspond with the pbm_dwnprocessenter event on a datawindow. in that user event, add the following 2 lines:
pb 5.0 method
send(handle(this),256,9,long(0,0)) // send message for processing tab key
return 1 // ignore processing of enter key
example
// the following example does an accepttext. if it gets a negative
// return code, then there was an error on the column, and you bypass
// the enter processing, and do not send the message for the tab key.
//
// it then checks to see if the current row and column are the last in
// the datawindow. if they are, it inserts a new row, scrolls to it,
// and sets the column to the first column in the row.
//
// if it is not the last row and column, it sends the tab key message,
// and bypasses the enter key processing.
//
// note: this script is in the user-defined event for pbm_dwnprocessenter.if this.accepttext() < 0 then
return 1
end ifif this.getcolumn() = long(dw_1.object.datawindow.column.count) then
if this.getrow() = this.rowcount() then
this.insertrow(0)
this.scrolltorow(this.getrow() + 1)
this.setcolumn(1)
return 1
end if
end if
send(handle(this),256,9,long(0,0))
return 1
pb 4.0 method
send(handle(this),256,9,long(0,0))
dw_1.setactioncode(1)
__-----> change this to whatever you called your
datawindow.
this will send the windows message for the tab key, and will bypass the processing for the
enter key.
example
// the following example does an accepttext. if it gets a negative
// return code, then there was an error on the column, and you bypass
// the enter processing, and do not send the message for the tab key.
- Copyright © 2001- 2010 丰搜网 All Rights Reserved
- ICP备案编号:粤ICP备06052964号
Java Asp PHP .Net XML C/C++ CGI VB Jsp J2ee J2se J2me EJB Servlet Tomcat Resin Struts Weblogic Eclipse ANT GUI JMS Web servise IDEA Webphere Hibernate Spring Jboss Applet Swing Socket Javamail Perl Ajax P2P 安全 模式 框架 测试 开源 游戏
Windows XP Windows 2000 Windows 2003 Windows Me Windows 9.x Linux UNIX 注册表 操作系统 服务器 应用服务器