PB8简明开发指南
- 格式:pdf
- 大小:168.64 KB
- 文档页数:11
在下拉数据窗口中查找与输入数据匹配的数据本篇文章来源与时代朝阳数据库(原晓通数据库)培训部PowerBuilder资料库。
从下拉数据窗口中查找数据时,一般情况下,需要从下拉数据窗口的第一行开始查找。
如果下拉数据窗口中的数据很少,只有十条左右,查找很方便。
但是,如果下拉数据窗口的数据很多,如上百条,则查找起来就会很麻烦。
下面讲述一种从下拉数据窗口中查找数据的方法。
该方法可以实现:将数据输入该列时,该列自动显示下拉数据窗口中与输入数据最匹配的第一个数据,下拉数据窗口自动滚动到被选数据所在的行,并且高亮度显示该行。
下面举例介绍,步骤如下:1. 创建窗口win_article_subject,在窗口中放置数据窗口控制dw_1。
2. 创建与窗口win_article_subject相连的数据窗口dw_article_subject,该数据窗口基于表“article_subject”。
创建“subject”列的下拉数据窗口dw_subject,该下拉数据窗口基于表“subject”。
创建好的窗口及数据窗口如下图所示:注意,在带有下拉数据窗口的列(“subject”列)中,必须指定该列的“Allow Editing”属性为True。
3. 在窗口中定义如下的实例变量:long il_rowcountboolean ib_keyworddatawindowchild idwc_datastring is_mach, is_type4. 在窗口的open事件写入如下的语句:ib_keyword = false5. 在窗口中定义名为“highlight”的用户自定义事件,不指定事件ID号、传入参数和返回值,并在事件中写入如下的语句:idwc_data.SelectRow(il_rowcount, TRUE)6. 创建全局函数gf_match_row,函数的参数和返回值定义如下表所示:返回类型为:长整型(Long)。
函数程序如下:string ls_mthtextlong ll_mthrowlong ll_counter = 1long ll_rowIF s_type = "number" THEN //检测列的数据类型是否为number//逐行检测下拉数据窗口中与输入数据最匹配的数据所在的行DO UNTIL ll_counter > dwc_name.RowCount()ll_mthrow = dwc_name.GetItemNumber(ll_counter, s_col_name)IF Left(string(ll_mthrow), i_length) = s_text THENll_row = ll_counterEXITELSEll_counter = ll_counter + 1END IFLOOPELSE//列的数据类型不是number//逐行检测下拉数据窗口中与输入数据最匹配的数据所在的行DO UNTIL ll_counter > dwc_name.RowCount()ls_mthtext = dwc_name.GetItemString(ll_counter, s_col_name)IF Left(ls_mthtext, i_length) = s_text thenll_row = ll_counterEXITELSEll_counter = ll_counter + 1END IFLOOPEND IFreturn(ll_row) //返回与输入数据最匹配的数据所在行的行号7. 在数据窗口控制的“cl icked”事件中写入如下的程序:ib_keyword = false8. 在数据窗口控制(dw_1)的“editchanged”事件写入如下程序://定义变量string ls_search, ls_col_namestring ls_attributeinteger li_string_length//获得具有下拉数据窗口列的列名ib_keyword = falsels_col_name = dw_1.GetColumnName()//判别当前列是否具有下拉数据窗口,如果不具有,则退出事件程序IF dw_1.GetChild(ls_col_name,idwc_data) < 0 THENreturnEND IF//获得下拉数据窗口的显示列及其类型ls_attribute = ls_col_name + ".dddw.displaycolumn"ls_col_name = this.Describe ( ls_attribute)ls_attribute = ls_col_name+".coltype"is_type = idwc_data.Describe(ls_attribute)//获得输入到列中的文本ls_search = dw_1.GetText()li_string_length = Len(ls_search)IF li_string_length = 0 THENreturnEND IF//找出下拉数据窗口中与输入数据最匹配的行il_rowcount = gf_match_row(idwc_data, ls_search,+&li_string_length,is_type,ls_col_name)IF il_rowcount <= 0 THENib_keyword = FALSEELSEib_keyword = TRUEidwc_data.SetRow(il_rowcount)IF is_type = "number" THENis_mach =string(idwc_data.GetItemNumber(il_rowcount,ls_col_name))dw_1.SetItem(dw_1.GetRow(),dw_1.GetColumn(), is_mach)ELSEis_mach = idwc_data.GetItemString(il_rowcount, ls_col_name)dw_1.SetItem(dw_1.GetRow(),dw_1.GetColumn(),is_mach)END IF//事件editchanged结束后,下拉数据窗口中被选中的行以高亮度显示parent.PostEvent("highlight")END IF运行窗口“win_article_type”,在数据窗口中的“subject”列中输入第一个字时,该列显示下拉数据窗口中与输入的第一个字相匹配的数据,下拉数据窗口自动滚动到该行,并且高亮度显示该行。
PB培训教程(提高篇)-(多场景)PB培训教程(提高篇)一、引言随着我国经济的快速发展,企业对人才的需求日益增长,专业技能培训成为了提升员工素质的重要途径。
PB(PowerBuilder)作为一款优秀的客户端/服务器应用程序开发工具,具有强大的数据处理能力和灵活的界面设计功能,广泛应用于企业级应用开发。
为了帮助广大PB爱好者提高开发技能,本教程将从实战角度出发,详细讲解PB的高级应用技巧。
二、PB开发环境介绍1.PB简介PowerBuilder(简称PB)是美国Sybase公司推出的一款客户端/服务器应用程序开发工具。
它采用面向对象的编程思想,支持多种数据库,具有强大的数据处理能力和灵活的界面设计功能。
PB在我国的企业级应用开发领域具有广泛的应用。
2.PB开发环境搭建(1)安装PB开发工具:并安装PB开发工具,根据提示完成安装过程。
(2)配置数据库连接:安装并配置数据库软件(如Oracle、SQLServer等),建立数据库连接。
(3)创建PB项目:在PB开发环境中创建新项目,配置项目属性,为后续开发做好准备。
三、PB高级应用技巧1.数据窗口应用(1)数据窗口简介:数据窗口是PB中用于数据显示和编辑的重要组件,具有强大的数据处理能力。
(2)数据窗口设计:掌握数据窗口的设计方法,包括数据源设置、列属性设置、样式设置等。
(3)数据窗口事件处理:了解数据窗口的事件处理机制,掌握常见事件(如Click、DoubleClick等)的编写方法。
(4)数据窗口与数据库交互:学习如何使用数据窗口进行数据的增、删、改、查操作。
2.PB与Web技术结合(1)Web开发简介:了解Web开发的基本概念,掌握、CSS、JavaScript等基本技术。
(2)PBWeb应用程序:学习如何使用PBWeb应用程序,包括Web数据窗口的使用、Web事件处理等。
(3)PB与WebService交互:掌握PB调用WebService的方法,实现PB与WebService的数据交互。
如何使用VSS对PB8.0下进行版本控制详解分类:PB文档(777)(0)在PB8.0下如何进行版本控制说明:由于本系统暂定使用微软的microsoft visual sourcesafe作为版本控制系统,所以,下面所提到的版本控制系统(source control system),就是指VSS。
写给开发人员:1、组织工作环境如果你是第一次接触本系统的开发,请您先登陆vss,到×××下载本系统的程序目录结构,然后运行PB8.0,添加此目录结构。
完成后,进行下一步PB与VSS的连接。
2、配置连接文件在PB8.0集成开发环境下,右击workspace ,在弹出的菜单中选择properties,弹出如图1所示的对话框。
选择source control项,进行连接文件的配置。
source control system:选择要使用的版本控制系统。
本系统使用微软的VSS,即选择microsoft visual sourcesafe项。
userID:输入你在版本控制系统(VSS)里的用户名。
Project:选择VSS上对应的工程。
首先单击文本框后面的按钮,显示登陆VSS的对话框,如图2,输入登录名称和密码后单击ok,弹出添加工程对话框.选则你所需要的工程,单击ok,系统会自动将工程名称和路径添加到文本框中。
※建议:不要自己填写工程名称和路径,通过选择会更准确且不容易出错。
Local Root Directory:为本地根目录输入或选择路径。
在这里就是你从VSS上下载程序目录结构所保存路径的上游路径,或者说就是你保存pbw文件的路径的上游路径。
注意:所有从版本控制系统check in和check out的workspace文件都必须包含在此路径里。
Connect:单击此按钮即于版本控制系统进行连接。
Advanced:单击进行高级选项的设置。
下面还有几个选项,他们的作用如下表,根据需要进行设置。
目录第一章PowerBASIC集成开发环境 (4)1启动 (4)1.1定位/G: (4)1.2主源文件/P: (4)2.PowerBASIC用户界面 (5)2.1菜单栏介绍 (6)2.1.1文件菜单(File) (6)2.1.2编辑菜单(Edit) (8)2.1.3运行菜单(Run) (10)2.1.4工具菜单(Tools) (10)2.1.5窗口菜单(Window) (11)2.1.6调试菜单(Debug) (12)2.1.7 帮助菜单(Help) (13)2.2 IDE 选项对话框 (14)2.2.1文件选项卡(File) (15)2.2.2 编辑器选项卡(Editor) (17)2.2.3编辑器文本选项卡(Editor Text) (19)2.2.4颜色选项卡(Color) (20)2.2.5打印机选项卡(Printer) (22)2.2.6编译器选项卡(Compiler) (23)2.2.7通用选项卡(General) (24)第二章编程基础 (26)1数据类型 (26)类型定义 (27)1.1整数型数据 (28)1.1.1字节(Byte ?) (28)1.1.2 字型(WORD ??) (28)1.1.3整型(Integers %) (28)1.1.4双字型(Double-word ) (29)1.1.5长整型(Long integers &) (29)1.1.6四字整型(Quad integers &&) (29)1.1.7小结 (29)变量类型与其它语言的对应关系 ...................................................................... 错误!未定义书签。
C/C++ .................................................................................................................... 错误!未定义书签。
AIP8F1016开发注意事项1.端口方向位操作与或问题:PXIO(端口输出输出寄存器)执行ANL、XRL、INC、DEC时会发生指令异常的情况。
解决方法:可通过设置一个缓冲寄存器,经过与或运算或在赋值给PXIO寄存器。
例:原程序:P1IO&=0xFB修改后的程序:io_temp=P1IO,io_temp&=0xFB,P1IO=io_temp;辅助纠正措施:烧录器软件PXIO逻辑运算提醒功能,在V3.5.1D之后的烧录器软件解析烧录文件时会自动检测是否存在PXIO逻辑运算。
图当出现该提示时需要查源程序中是否存在PXIO逻辑运算2.端口输入问题:切记:PX1端口不能作为输入口!,其他端口可以作为输入。
如果必须要用,则读取PX端口状态的时候,需利用push和pop指令。
ea_temp = EA; //缓冲当前EA状态EA = 0; //关闭总中断_push_(P0); //P0的值入栈_pop_(FSADRM); //P0的值出栈到FSADRM寄存器中P0_temp = FSADRM; // FSADRM的值给P0_tempEA = ea_temp; //恢复EA状态key_buff = (~P0_temp)&0x72; //读取状态值3.用软件自动生成的中断序列号要比说明书中的序列号小1.4.端口位操作注意事项:在使AIP8F1016 芯片时,要注意,当端口作为输入,且使用位读时(如if(P01 == 1)),可能回出现死机的等问题。
所以工程师建议做输入口时,不要使用位操作,可采用整个字节操作(如if(P0 & 0x01 !=0) )。
5.中断标志清零:EIFLAG0中中断标志位必须用软件clear。
芯片不会自动清零。
6.WDT:应用AIP8F1016 芯片在看门狗设置时注意,请将WDTCR值设置为0xE2,应用看门狗专用时钟,不要用主时钟!WDTDR值请根据主程序运行时间合理设置!初始设置:WDTDR=0xXX;WDTCR=0xE2;主循环清狗操作:WDTCR|=0xE2;7.中断防抖设置:AIP8F1016 全系列芯片,凡用到外部中断端口功能时,一定要打开该端口的防抖功能(debounce):以AIP8F1016 芯片为例,涉及到的外部中断端口有:P02~P07,----对应P0DB寄存器(Bit0~Bit5)P16,P17,P11,P12,P52,P54 ---对应P15DB寄存器(Bit0~Bit5)设置时将相应的位置1即可!需要着重注意的是:P0DB,Bit7,Bit6是设置去抖时间,不管用到哪个中断端口,这两个位都要设置,否则选择debounce 也无意义:00,fx/101,fx/410, fx/4096 (建议设置成10)设置后:在上升沿和下降沿有干扰时,芯片不会多次进入中断。
PB8程序设计培训讲义PB8 程序设计培训课程⽬录前⾔------PB8 程序设计培训课程安排 (1)第⼀章PB8集成开发环境介绍 (2)第⼆章PB8的数据库管理功能 (6)第三章PB8语⾔及其系统函数 (8)第四章PB8的窗⼝对象及实例 (14)第五章PB8控件应⽤实例详解 (21)第六章PB8数据窗⼝控件详解 (22)第七章PB8数据窗⼝对象详解 (30)第⼋章模块复⽤技术实例详解 (33)第九章PB8开发多层应⽤详解 (36)第⼗章程序的发布与安装制作 (37)注意:本培训讲义中所⽤的特殊符号含义如下。
要点?实例配置步骤&选学内容第⼀章PB8集成开发环境介绍⼀、PB8与现⾏开发⼯具对⽐开发效率(MIS) 多层构架界⾯制作适⽤范围PB 很⾼很⾼⼀般数据库VB ⼀般⼀般较好⼀般DELPHI ⼀般⼀般最好最⼴⼆、PB8开发⼯具的发展历程PB6 每次只能开发⼀个应⽤,不能同时修改代码与界⾯PB7 每次只能开发⼀个应⽤,可以同时修改代码与界⾯PB8 每次可以开发多个应⽤,可以同时修改代码与界⾯三、PB8的特点1.初学有障碍,⼊门后进境迅速2.界⾯较单⼀,需⽤⼼制作界⾯3.完全的⾯向对象4.基于事件驱动的程序设计5.开放的数据库系统6.多平台的⽀持7.⽀持团队开发,集成的源代码控制系统8.⽀持多层应⽤程序组件的部署9.简洁的模块复⽤技术四、PB8新增的功能1.功能强⼤的系统树2.灵巧的输出窗⼝3.深得⼈⼼的剪贴窗⼝4.⽅便的WEB开发,集成了PowerSite站点开发⼯具5.优雅的源代码编辑器6.整合的组件服务器7.新的数据库驱动接⼝8.新增的系统函数9.新增的错误捕获技术五、PB8的IDE环境1.新增[new]的使⽤2.继承[inherit]的使⽤3.打开[open]的使⽤4.预览[preview]的使⽤5.系统树[system tree]的使⽤6.输⼊窗⼝[output]的使⽤7.错误消息切换[error message]的使⽤8.任务列表[to-do list]的使⽤9.浏览窗⼝[browse]的应⽤10.剪贴窗⼝[clip window]的使⽤11.库画板画板[library]的使⽤12.数据库配置⽂件[db profile]的使⽤13.服务器配置⽂件[easerver profile]的使⽤14.数据库画板[database]的使⽤15.多功能编辑器[edit]的使⽤16.部署应⽤程序[deploy]的使⽤17.调试[debug]的使⽤18.运⾏[run]的使⽤六、PB8做MIS系统的流程1.不得不做的需求分析(⽤户⼿册)2.系统设计⽅法(概要设计、详细设计、操作⼿册)3.数据库设计⽅法4.程序设计⽅法及注意事项5.软件测试及试运⾏6.后期维护与⼆次开发七、PB8开发应⽤程序的步骤1.创建⼀个⼯作区(*.pbw)NEW>WORKSPACE2.创建⼀个⽬标⽂件(*.pbt),规划库列表(*.pbl),设置全局属性3.创建数据库配置⽂件(*.ini)4.设置事务属性、连接数据库、测试连接是否成功5.创建主菜单、为菜单指定⼯具条图标6.创建主窗⼝(TYPE:mdihelp),关联主菜单到主窗⼝(主窗⼝不充许放置控件)7.创建⼯作窗⼝(TYPE:main),在主菜单中打开8.布置控件到⼯作窗⼝、9.⽣成数据窗⼝对象,将它与⼯作窗⼝的数据窗⼝控件关联10.为⼯作窗⼝的事件编写代码(OPEN)11.为⼯作窗⼝的控件编写代码⼋、PB8创建菜单的⽅法1.创建⼦菜单(submenu)2.添加菜单3.插⼊菜单4.编辑菜单5.复制⽣成菜单6.删除菜单九、PB8创建⼯具栏的⽅法1.为对应菜单指定⼯具条图标2.为对应菜单指定⼯具条提⽰3.为对应菜单指定⼯具条次序4.为对应菜单指定⼯具条索引⼗、PB8应⽤对象、菜单对象详解1.应⽤对象属性、事件、函数及附加属性AppName StringClassDefinition PowerObjectDDETimeOut IntegerDisplayName StringDWMessageTitle StringFreeDBLibraries BooleanMicroHelpDefault StringRightToLeft BooleanToolbarFrameTitle StringToolbarPopMenuText StringToolbarSheetTitle StringToolbarText BooleanToolbarTips BooleanToolbarUserControl BooleanClose When the user closes the application.ConnectionBegin Obsolete (used for distributed PowerBuilder connections) ConnectionEnd Obsolete (used for distributed PowerBuilder connections) Idle 由空闲函数触发Open When the user runs the application.SystemError When a serious execution time error occursClassName String Returns the class of the Application object. GetContextService IntegerPostEvent BooleanSetLibraryList Integer Sets the PBD library list in an executable. SetTransPool IntegerTriggerEvent IntegerTypeOf Object (if typeof(this)=application! Then end if)2.菜单对象属性、事件、函数Checked BooleanClassDefinition PowerObjectDefault Boolean (是否加⿊)Enabled BooleanItem[ ] Menu Specifies the Menu objects under a Menu object.MenuItemType MenuItemTypeMergeOption MenuMergeMicroHelp String Specifies the text of the MicroHelp for the object.ParentWindow Window Specifies the window that owns the Menu object.ShiftToRight Boolean (在继承菜单中指定菜单项的位置)Shortcut IntegerTag String Specifies the tag value assigned to the Menu object.Text String Specifies the text in the Menu object.ToolbarItemDown Boolean .ToolbarItemDownName StringToolbarItemBarIndex IntegerToolbarItemName StringToolbarItemOrder Integer Specifies the order of the item in the toolbar.ToolbarItemSpace IntegerToolbarItemText StringToolbarItemVisible BooleanClicked When the Menu object is clicked (selected or unselected).Help When the user presses the F1 key or drags the context help buttonSelected When the user moves to the Menu object using the arrow keys or the mouse.Check IntegerClassName String Returns the class of the Menu object.Disable IntegerEnable IntegerGetContextService IntegerGetParent PowerObject (getparent().classname()如果是菜单,返回上级菜单) Hide Integer Makes the Menu object invisible. PopMenu Integer Displays the Menu object at the specified location.PostEvent IntegerShow Integer Makes the Menu object visible.TriggerEvent IntegerTypeOf Object Returns the type of the control.Uncheck Integer3.⼀个PB应⽤实例第⼆章PB8的数据库管理功能⼀、如何使⽤ODBC连接数据库创建数据源、创建ODBC配置⽂件(ACCESS、SQL、ORACLE)DB PROFILE ⼆、如何使⽤专⽤接⼝连接数据库创建专⽤接⼝的配置⽂件(SQL、ORACLE)三、如何使⽤OLE DB接⼝连接数据库创建OLE DB接⼝的配置⽂件(SQL、ORACLE)四、事务对象与事务控制语句(SQLCA)1、事务对象的属性、事件、函数2、常⽤的事务控制语句五、常⽤的SQL语句1、DML语句SELECT 、INSERT 、DELETE 、UPDA TE2、DCL 语句GRANT、REVOKE3、DDL语句CREA TE DA TABASE、CREA TE TABLE、CREA TE VIEW、CREA TE DEFAULT CREA TE RULE、CREA TE INDEX ALTER DA TABASE、ALTER TABLE、ALTER VIEW、ALTERDEFAULTALTER RULE 、ALTER INDEXDROP DA TABASE、DROP TABLE、DROP VIEW、DROP DEFAULTDROP RULE、DROP INDEX4、⾼级SQL选项GROUP BY、ORDER BY、DISTINCT、UNION5、常⽤SQL聚合函数SUM()、MAX()、MIN()、COUNT()、A VG()6、常⽤SQL函数GETDA TE()、CONVERT()、CAST()六、使⽤数据库画板创建数据库对象、数据管道的使⽤1、创建、修改与删除表、视图2、创建⾓⾊、登录帐号、⽤户3、创建主键、外键、索引及其作⽤4、创建与使⽤数据管道导⼊数据5、数据库画板中不得不注意的事项(恢复原来布局)七、创建存储过程、函数、触发器与游标CREA TE PROCEDURE、CREA TE FUNCTIONCREA TE TRIGGER、DECLARE CURSORALTER PROCEDURE、ALTER FUNCTION、ALTER TRIGGER DROP PROCEDURE、DROP FUNCTION、DROP TRIGGER ⼋、配置⽂件的⽣成与⽤法1、⽣成配置⽂件2、使⽤配置⽂件3、使⽤注册表项九、接对象的创建与⽤法创建与使⽤连接对象(声明实例对象)⼗、动态SQL的四种语法格式(help:Dynamic)1、没有输⼊与输出参数的SQL2、有输⼊参数没有输出参数的SQL3、有输⼊参数输出参数的SQL4、未知的返回结果集类型的SQL5、PB⾃带的系统表⽤法6、上机练习作业:按下图所⽰、制作出“商品类别录⼊”窗⼝与“商品单位录⼊”窗⼝第三章PB8语⾔及其系统函数⼀、Power Script语⾔的数据类型Blob(图像)Integer or Int 2^16(2*8)Boolean Long 2^32(4*8)Char or character(单个字符)RealDate StringDateTime TimeDecimal or Dec UnsignedInteger, UnsignedInt, or UInt decimal {3} ld_price Double UnsignedLong or ULong ⼆、Power Script语⾔的运算符1、算术运算符+、-、*、/、^(2^3=8)2、关系运算符=、>、<、>=、<=、<>3、连接运算符+ ‘a’+’b’=’ab’4、续⾏运算符& 两⾏或多⾏做为⼀⾏来执⾏5、逻辑运算符AND、OR、NOT6、特殊运算符适⽤于SQL语句IS、LIKE、NOT LIKE、BEWTEEN…AND、IN、NOT IN三、Power Script语⾔的注释1、⾏注释// int li_msg = 12、块注释/* int li_msg = 1 */3、注释的作⽤四、常量、变量、数组的定义与使⽤1、常量的定义与使⽤(CONSTANT int MIN = 1000)常量不允许修改2、变量的定义与使⽤数据类型变量名int li_max3、数组的定义与使⽤数据类型数组名[n,m] int li_demo[] int li_demo1[2 to 10]4、标识符的声明规范(变量与对象)五、Power Script语⾔的系统函数1.数组函数LowerBound The lower bound of dimension n of a specified array. UpperBound The upper bound of dimension n of a specified array.2.BLOB函数Blob Convert or copy data to a blob data typeBlobEdit Copy data into a variable starting at a given positionBlobMid Obtain characters in blob data starting at character n.Len Obtain the length of a blobString Convert a blob to a string3.数据类型转换函数Asc Obtain the ASCII value of a character.Char Obtain a blob, integer, or string as a char.Dec 把⼀个(数字)字符串转换为⼀个DEC类型的数dec(‘123.45’)=123.45 Double Obtain the contents of a string as a double.Integer Obtain the contents of a string as an integer.Long Obtain the contents of a string as a long.Real Obtain the contents of a string as a real.Date Obtain the date portion of a DateTime valueDateTime Obtain a date and a time as a DateTime value.IsDate Determine whether the specified string contains a valid dateIsNull Determine whether the argument is NULL.IsNumber Determine whether the specified string contains a number. IsTime Determine whether the specified string contains a valid time. String Obtain a date to a string formatted in a specified formatTime Obtain the time portion of a DateTime value4.⽇期时间函数Day The day (an integer between 1 and 31)DayName The name of the day of the weekDayNumber for example, Sunday is 1 and Wednesday is 4 DaysAfter The number of days one date occurs after anotherHour The time from which you want to obtain the hourMinute The time from which you want to obtain the minutesMonth The month (an integer between 1 and 12)Now系统时间RelativeDate The date that occurs n days after a given date RelativeTime The time that occurs n seconds after a given time. Second The number of seconds in the seconds portion of a given time. SecondsAfter The number of seconds one time occurs after another. Today系统⽇期Y ear The year (an integer between 1000 and 3000)5.⽬录⽂件函数FileClose (3)Close a fileFileCopy Copy a fileFileDelete Delete a fileFileExists Determine whether a file existsFileLength Obtain the length of a fileFileMove Move a fileFileOpen(1)Open a fileFileRead (2)Read a fileFileSeek Seek to a position in a fileFileWrite (2) Write to a file.ChangeDirectory Change directoryCreateDirectory Create a directoryDirectoryExists Determine if a named directory exists GetCurrentDirectory Get the name of the current directory GetFileOpenName Display Open File dialog. GetFileSaveName Display Save File dialog.RemoveDirectory Remove a directory6.数值函数Abs Obtain the absolute value of a number.ASin Obtain the arcsine of an angle. The angle is in radians.ACos Obtain the arccosine of an angle. The angle is in radians.A Tan Obtain the arctangent of an angle. The angle is in radians.Ceiling 返回⼤于给定值的最⼩整数ceiling(3.2) = 4Cos Obtain the cosine of an angle. The angle is in radians.Exp Obtain e raised to the power of x.Fact Obtain the factorial of x.Int 返回⼩于给定值的最⼤整数int(3.2) = 3Log Obtain the natural logarithm (base e) of a number.LogTen Obtain the decimal logarithm (base 10) of a number.Max Obtain the larger of two numbers.Min Obtain the smaller of two numbers.Mod Obtain the modulus of two numbers (for example :mod(1,2)=1)余数Pi Obtain pi (3.14159265358979323) times a number.Rand Obtain a random whole number (between 1 and a specified number). Rand(10) Randomize Initialize the random number generator.Round Obtain a number rounded to a number of decimal places.Sign Obtain a number (-1, 0, or 1) indicating the sign of a number.Sin Obtain the sine of an angle. The angle is in radians.Sqrt Obtain the square root of a number.Tan Obtain the tangent of an angle. The angle is in radians.Truncate Obtain a number truncated to a specified number of decimal places.7.打印打印机函数Print Print a string in the current font.PrintBitmap Print a specified bitmap image at a specified location in the print area.PrintCancel Cancel printing.PrintClose(3)Close the print job and sends the page to the printer.PrintDataWindow(2)Print a DataWindow with other DataWindows in a print job.PrintDefineFont Define a font for the print job.PrintLine Print a line of a specified thickness at a specified location.PrintOpen(1)Start the print job and assigns it a print job number.PrintOval Print an oval with a specified line thickness at a specified location.PrintPage Send the current page to the printer and sets up a new blank page.PrintRect Print rectangle with specified line thickness at a specified location.PrintRoundRect Print round rectangle with specified line thickness specified location.PrintScreen(2)Print the screen image as part of a print job.PrintSend Send a specified string directly to the printer.PrintSetFont Set the current print job font to one of the defined fonts.PrintSetSpacing Sets the spacing factorPrintSetup Call the Printer Setup dialog box for the printer driver.PrintText Print specified text at a specified location.PrintWidth Return the width (1/1000s inch) of the specified string.PrintX Return the X coordinate of the cursor.PrintY Return the Y coordinate of the cursor.// 打印机函数PrintGetPrinter Get the name of the current printerPrintGetPrinters Get the names of available printersPrintSetPrinter Set the default printerPrintSetupPrinter Display the printer setup dialog box8.注册表函数RegistryDelete Delete a key or value for an entry in the system registry. RegistryGet从注册表读取信息RegistryKeys Get the subkeys available for a particular key.RegistrySet向注册表写⼊信息.RegistryV alues Get the set of named values for a particular key.9.字符串函数Asc The ASCII value of the first character of a string.Char The character that corresponds to an ASCII value.Fill A string of a specified length filled with occurrences of a specified string. LastPos The last position of a string within a specified string.Lastpos(‘adaddadda’,’da’)Left A specified number of characters from a string, starting with the first character. LeftTrim A copy of a specified string with leading blanks deleted.Len 求字符串的字符个数Lower A copy of a specified string with all uppercase letters converted to lowercase. Match A determination whether a string contains a particular pattern of characters. Mid从给定的字符串中取⼀个指定的⼦串mid(‘abcde’,2,3)=’bcd’Pos pos(‘abcde’,’bc’)=2Lastpos(‘adaddadda’,’da’)=8Replace A copy of a specified string in which a specified number of characters Reverse Reverses the order or characters in a string.Right A specified number of characters from the end of a specified string. RightTrim A copy of a specified string with trailing blanks deleted.Space A string of a specified length filled with a specified number of spaces.Trim A string with leading and trailing blanks deleted.WordCap Capitalize the first letter of each word in a passed scriptUpper all lowercase letters converted to uppercase.10.系统与环境函数Clipboard Obtain the contents of the Windows clipboard CommandParm Retrieve the parameter stringGetApplication Gets the handle of the current Application object GetEnvironment about system, processor, and screen display of the system GetFocus 返回当前具有焦点的控件Handle Obtain the Windows handle of a PowerBuilder object.Post Adds a specified message, wordProfileInt Obtain an integer from a specified profile fileProfileString Obtain a string from a specified profile fileRestart and disconnects from the database, and restarts the application Run Execute (run) a specified programSend sends a specified message, lowword, or long to a specified window SetProfileString Write a value to a specified profile fileSignalError Cause a SystemError event at the application levelYield checks the message queue11.定时函数CPU Obtain the number of milliseconds of CPU time elapsed.Idle 必须在应⽤对象中作⽤Start Activate a timing object causing a Timer eventTimer定时函数,在窗⼝对象中使⽤12.未归类函数Beep Cause the computer to beep a specified number of times. ChooseColor Display the standard color selection dialog box. ClassName Determine the data type of a variable.DebugBreak Suspend execution and opens the Debug window. GetFolder Display a folder selection dialog box.IntHigh Obtain the high word of a long value.IntLow Obtain the low word of a long value.IsV alid Determine whether a specified window is openKeyDown Determine whether the user pressed a specified key MessageBox Display a box containing a message.PixelsToUnits Convert pixels to PowerBuilder unitsPopulateError Fill in the Error object without causing a SystemError event.RGB Determine the long that represents a specified color.SetNull Set any variable to NULLSetPointer Set the pointer to a specified typeSignalError Cause a SystemError event at the application level.Sleep Cause the application to pauseUnitsToPixels Convert units to pixels六、变量的类型与作⽤域1、全局变量及作⽤域在程序的任何地⽅都起作⽤。