




已阅读5页,还剩38页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
Accounting InformationAccounting Information 熟悉逐步熟悉PowerScript的基础语法及语句 (Are familiar with the foundation to gradually familiar with the PowerScript syntax and statement) 掌握常见的窗口控件 ( Grasp the common window control ) 学习目的与要求学习目的与要求 Learning Objectives and RequirementsLearning Objectives and Requirements 3-2 3-2 编程基础与常用控件技术编程基础与常用控件技术 Programming with the Common Control Programming with the Common Control TechnologyTechnology 教学内容教学内容 (Teaching content)(Teaching content) 3-2 3-2 编程基础与常用控件技术编程基础与常用控件技术 Programming with the Common Control Technology 2.1 对象编程基础 (Object-based programming) 2.2 PowerScript语言 (PowerScript Language ) 2.3 窗口控件 (Window Control ) 2.4 常用函数 (Common Functions ) 2.5 对象菜单 (Object Menu ) 3-2.1 3-2.1 对象编程基础对象编程基础object-oriented programming-basedobject-oriented programming-based 脚本也称为事件处理程序,是指动作发生时相应执行的一段程序 The script is also known as the event handler refers to the action occurs, the corresponding period of the implementation of procedures for. 指作用在对象上的动作,当事件触发时,执行脚本。 Event refers to the role of the object movements, when the event is triggered, the implementation of the script. 对象 事件 脚本 表示单一的实体 (如窗口、按钮 等) 名字 属性 方法 事件(Event) 函数(Fuction) Object represents a single entity (such as windows, buttons, etc.) 3-2.1 3-2.1 对象编程基础对象编程基础object-oriented programming-basedobject-oriented programming-based 例:按钮对象例:按钮对象 正文 宽度 高度 教学内容教学内容 3-2 3-2 编程基础与常用控件技术编程基础与常用控件技术 2.1 对象编程基础 2.2 PowerScript语言 2.3 窗口控件 2.4 常用函数 2.5 对象菜单 3-2.2 3-2.2 PowerScriptPowerScript语言语言 注释(/):行注释和块注释 标识符 大小写 命令结束符(回车键) 行继续符(&) 空值(null) 保留字 操作符 算术运算符、关系运 算符、逻辑运算符、 字符串的连接 保留字供 PowerBuilder内 部使用 语言基础 3-2.2 3-2.2 PowerScriptPowerScript语言语言 数据类型、变量和常量数据类型、变量和常量Data types, variables and constantsData types, variables and constants (1)标准数据类型 Standard data types integer或int(整型 ),整数的取值范围 是从-32768到32767 (integer or int (integer), integer values range from - 32768 to 32767 ) boolean(布尔型),布 尔变量有两个值:true和 false,分别表示真和假 (boolean (boolean type), Boolean variables are two values: true and false, true and false, respectively ) real(实型),实型变量 被创建时的初始值是0 (real (solid type), real variables are created when the initial value is 0 ) char或character(字符 型),该类型变量用于存 储一个ASCII字符。 (char or character (character), the type of variable is used to store an ASCII character. )date(日期型) ,日 期包含年、月、日,年 月日之间用连接符(- )连接。(date (date type), the date contains the year, month, day, date with the connection between the sign (-) connection. ) time(时间型) ,包含小时 、分钟、秒,小时、分钟、秒 之间用冒号(:)分隔 (time (time type), including hours, minutes, seconds, hours, minutes, seconds with a colon (:) separated) string(字符串 型) ,字符串要 用引号括起来 (string (string), string enclosed in quotation marks ) 3-2.2 3-2.2 PowerScriptPowerScript语言语言 数据类型、变量和常量数据类型、变量和常量 (2)变量的声明(Variables Declaration ) 变量是指在程序运行过程中其值可以改变的量。 (Variable refers to the program is running, the amount of its value can be changed. ) l变量声明的一般语法结构是: 数据类型 标识符=初值 ,标识符=初值, (The general structure of variable declaration syntax is: Data type identifier = initial value , identifier = initial , . ) 变量未赋初值,系统会自动赋给变量默认值。如:数 值型变量的默认初值是0。 (Variable is not assigned the initial value, the system will be automatically assigned to the variable default value. Such as: numerical variables default initial value is 0. ) 3-2.2 3-2.2 PowerScriptPowerScript语言语言 变量的作用域就是变量使用的范围变量的作用域就是变量使用的范围 变量的作用 全局变量的作用域最大,它在 应用程序的任何地方都可以使 用。 实例变量是某个特定对象可使 用的变量。 共享变量是某类特定对象可使 用的变量,并不常用。 局部变量只能在某程序段或函 数内部有效,可以在过程、代 码、函数内部声明和使用局部 变量 3-2.2 3-2.2 PowerScriptPowerScript语言语言 Variable scope is the scope of the variable Variable scope is the scope of the variable usedused The role of the variable The largest global variable scope, its application can be used anywhere. A particular object instance variable is a variable that can be used. Shared variable is a particular object of certain variables that can be used is not commonly used. Local variables can only be in a program segment or function within the force, in the process, the code inside the function declaration and the use of local variables 3-2.2 3-2.2 PowerScriptPowerScript语言语言 基本语句(Basic Statements ) 赋值语句赋值语句(=)(=) Assignment statement (=)Assignment statement (=) 循环语句循环语句(LOOP) doloop(LOOP) doloop结构和结构和 fornextfornext Loop (LOOP) do . loop structure and Loop (LOOP) do . loop structure and the for . nextthe for . next 流程控制语句流程控制语句(EXIT)(EXIT) Flow control statements (EXIT)Flow control statements (EXIT) 条件语句条件语句(IF)(IF) Conditional statements (IF)Conditional statements (IF) 3-2.2 3-2.2 PowerScriptPowerScript语言语言 基本语句(Common use of pronouns ) 对象事件触发语句对象事件触发语句 The object event trigger statementThe object event trigger statement 用法: objectname.TriggerEvent ( event , word, long ) 3-2.2 3-2.2 PowerScriptPowerScript语言语言 常用代词的使用常用代词的使用 (1)This代词 This代词代表窗口、用户对象、菜单、应用对象或控件本身。 (2)Parent代词 Parent代词可以用在窗口控件、用户定制的对象。在窗口控件中使用 parent时,parent表示包含该控件的窗口。 (3)ParentWindow代词 ParentWindow代词只能在菜单脚本中使用,它代表运行时菜单所在的窗 口 3-2.2 3-2.2 PowerScriptPowerScript语言语言 Common use of pronounsCommon use of pronouns (1) This pronoun This pronoun on behalf of the window, user object, menu, application object or the control itself. (2) Parent pronoun Parent pronoun can be used in the window controls, custom objects. The use of parent control in the window when, parent window that contains the control. (3) ParentWindow pronoun ParentWindow pronoun to use only the script in the menu, which represents the window where the run-time menu. 教学内容教学内容 3-2 3-2 编程基础与常用控件技术编程基础与常用控件技术 2.1 对象编程基础 2.2 PowerScript语言 2.3 窗口控件 2.4 常用函数 2.5 对象菜单 3-2.3 3-2.3 窗口控件窗口控件 激活动作的控件:用于激活某个事件,执行一些功能性 操作。如CommandButton、PictureButton。 显示数据的控件:用于输入、修改、显示数据等。如 DataWindows、SingleLineEdit。 用作选择项的控件:用于从若干信息中选择信息。如 RadioButton、CheckBox。 仅作修饰的控件:用于修饰窗口,使窗口更清晰、美观。 如Line、Rectangle、RoundRectangle、Oval。 从功能角度看,控件分为 3-2.3 3-2.3 窗口控件窗口控件 Activated action control: used to activate an event, perform some functional operations. Such as CommandButton, PictureButton. Display data control: used to enter, modify, display data. If DataWindows, SingleLineEdit. Select items for the control: for information from a number of select information. As RadioButton, CheckBox. Modified only control: used to modify the window, so that the window is more clear, beautiful. Such as Line, Rectangle, RoundRectangle, Oval. From a functional point of view, control is divided into 3-2.3 3-2.3 窗口控件窗口控件 窗口中的控件操作 添加控件添加控件复制控件复制控件选择控件选择控件删除控件删除控件 3-2.3 3-2.3 窗口控件窗口控件 常用控件 命令按钮CommandButton 单选钮RadioButton 复选框CheckBox 单行编辑框SingleLineEdit 多行编辑框MultiLineEdit 掩码编辑框EditMask 标签Tab 列表框ListBox 下拉列表框DropDownListBox 滚动条ScrollBar 进度条ProgressBar 3-2.3 3-2.3 窗口控件窗口控件 控件的命名 命令按钮cb_ 单选钮rb_ 复选框cb_ 单行编辑框sle_ 多行编辑框mle_ 掩码编辑框em_ 数据窗口控件dw_ 窗口控件w_ 控件是构成应用程序界面的重要元素,同时也是显示和输入数 据的主要方式。 对控件命名应遵循一定规范,如: 3-2.3 3-2.3 窗口控件窗口控件 控件的操作 Control the operation of 1、选择控件(select Control ) 2、移动控件(Mobile Controls ) 3、删除控件(delete the control ) 4、改变控件大小(change the size of the control ) 5、控件格式调整(the control format adjustment ) 6、复制、粘贴控件(copy, paste control ) 3-2.3 3-2.3 窗口控件窗口控件 控件的焦点和Tab次序 Control the focus and Tab Order 控件或窗口得 到焦点的途径 The control or window may to focus on ways to 1.运行时用户选择对象。 Run-time user to select the object. 2.运行时用户使用快捷键选择对 象。 Run-time users to use the shortcut key to select The object. 3.在代码中使用SetFocus() 函 数设置焦点。 In the code using the SetFocus () function sets the focus. Tab次序 Tab Order 程序运行后用户按Tab键时焦点的跳转顺序 After the program runs when the user presses the Tab key to jump the focus of the order of Definition shortcuts 3-2.3 3-2.3 窗口控件窗口控件 定义快捷键 对没有标题的控件,比如单行编辑框、多行编辑框、列表框、 下拉列表框等,定义快捷键的方法是: 在“General”标签页的“Accelerator”编辑 框中键入作为快捷键的字符,例如,要使Alt+A 成为单行编辑框的快捷键,那么在 “Accelerator”编辑框中键入字符“a”。 3-2.3 3-2.3 窗口控件窗口控件 定义快捷键 Control the absence of title, such as single-line edit boxes, multi-line edit boxes, list boxes, drop-down list box, etc., define shortcut keys method is: In the “General“ tab of the “Accelerator“ edit box, type the character as a shortcut, for example, Alt + A to make a single-line edit box of the shortcut keys, then the “Accelerator“ edit box, type the characters “a“. 3-2.3 3-2.3 窗口控件窗口控件 指定控件的可访问性(Specified control accessibility) 对大多数控件来说,均可通过下述两个Boolean型属性控制控 件的可访问性 (For most controls, the can be accessed through the following two Boolean-type property controls the accessibility of the control) 这两个属性都可以在控件属性对话框“General”标签页的 “Visible”和“Enabled”复选框中设置。 (These two properties can be in the control Properties dialog box, “General“ tab of the “Visible“ and “Enabled“ check box set.) 3-2.3 3-2.3 窗口控件窗口控件 常用窗口控件命令按钮 Commonly used windows controls - a command button 命令按钮是用于响应用户的操作指令的对象。 Command button is used to respond to the users operating instructions of the object. 设置命令按钮属性,命令按钮有一组属性,选中命令 按钮后,单击窗口画笔工具栏的“Properties”图标 Set the command button properties, a command button has a set of properties, select the command button, click the brush tool bar window “Properties“ icon 该对话框有五个标签页组成:“General”、 “Font”、 “Position”、“Pointer”、“Drag and Drop” This dialog box has five tabs: “General“, “Font“, “Position“, “Pointer“, “Drag and Drop“ 3-2.3 3-2.3 窗口控件窗口控件 命令按钮的事件,命令按钮有十几个事件,其中最常用、最重 要的事件是 事件,它在被单击时触发。 Incident command button, command button, there are more than a dozen incidents, one of the most common and most important event of the event, it was triggered when clicked. Clicked 相关对象: 3-2.3 3-2.3 窗口控件窗口控件 常用属性:TEXT-静态文本框内显示的信息 Common attributes: TEXT-static text box displays the information 它通常用于输入一行文本、键入用户保密字等。 常用事件:modified,getfocus,losefocus It is usually used to enter the line of text, type the security word so the user. Common Event: modified, getfocus, losefocus 通常用于固定数据的选择 Selection of commonly used fixed data (textbox) (SingleLineEdit) (DropDownListBox) 教学内容教学内容 3-2 3-2 编程基础与常用控件技术编程基础与常用控件技术 2.1 对象编程基础 2.2 PowerScript语言 2.3 窗口控件 2.4 常用函数 2.5 对象菜单 3-2.4 3-2.4 常用函数常用函数 OPEN()函数 功能: 打开窗口。 语法 Open(windowname) Today()函数 功能:得到当前系统日期 。 语法:Today() 返回值:Date CLOSE()函数 功能:关闭窗口并释放窗 口以及窗口上的控件所占 据的内存。 语法:Close(windowname ) Now()函数 功能:得到客户机的当前 系统时间,返回值为Time 类型。 语法:Now() 返回值:Time Timer()函数 功能:在指定的时间 间隔内反复触发指定 窗口的定时器事件 语法: Timer(interval,wi ndowname) 3-2.4 3-2.4 常用函数常用函数 OPEN ( ) function Function: open the window. Syntax Open(windowname) Today () function Function: get the current system date. Syntax: Today () Return Value: Date CLOSE () function Function: Close the window and release the window and the window controls on the occupied memory. Syntax: Close (windowname) Now () function Function: get the clients current system time, the return value for the Time type. Syntax: Now () Return Value: Time Timer () function Function: at a specified timeTriggered repeatedly within a specified interval Windows timer event Syntax: Timer (interval (windowname) 3-2.4 3-2.4 常用函数常用函数 示例(Example) 示例1 示例2 示例3 下面的语句每隔3秒触发一次当前 The following statement once every 3 seconds to trigger the current 窗口的Timer事件:Timer(3) Window Timer event: Timer (3) 下面的语句停止当前窗口的定时 器:Timer(0) The following statement stops the current timing window Device: Timer (0) 下面的语句每隔0.5秒触发一次w_Emp窗口的Timer事件: Open(w_Emp)Timer(0.5, w_Emp) The following statement is triggered once every 0.5 seconds w_Emp window Timer event: Open (w_Emp) Timer (0.5, w_Emp) 3-2.4 3-2.4 常用函数常用函数 函数语法格式: ReturnValue = messagebox(title,text,icon,buttons, default) Messagebox( )函数 messagebox( )函数用来向用户显示信 。 3-2.4 3-2.4 常用函数常用函数 类型转换函数Type Conversion Functions 类型转换函数用来将一种数据类型转换为另一种数据类型。 Type conversion functions are used to convert a data type to another data type. integer(string):将字符串转换成整型。 integer (string): convert a string into an integer. long(string) :将字符串转换成长整型。 long (string): convert a string to an integer to grow. real(string) :将字符串转换成实型。 real (string): string to convert into a real type. double(string) :将字符串转换成双精度型。 double (string): string to convert to dual precision type. dec(string) :将字符串转换成十进制数(decimal)。 dec (string): to convert a string into a decimal number (decimal). string(number,format) :将数值按一定格式转换成字符串。 string (number, format): the values according to a certain format, converted to a string. 教学内容教学内容 3-2 3-2 编程基础与常用控件技术编程基础与常用控件技术 2.1 对象编程基础 2.2 PowerScript语言 2.3 窗口控件 2.4 常用函数 2.5 对象菜单 3-2.5 3-2.5 菜单菜单 在Windows应用程序中,菜单用于功能选择,通常还把工具栏按 钮和菜单命令关联起来 In the Windows application, the menu for the function of choice, usually also toolbar buttons and menu commands associated with them 为方便用户操作,使用菜单还可以有多种方法,既可以用鼠标 ,也可以用键盘,用键盘时可以使用热键和快捷键。 For the convenience of the user operation, use the menu can also be a variety of ways, either with the mouse, you can also use the keyboard, using keyboard hot keys and shortcut keys can be used. 状态条一般显示在窗口的底部,向用户提示使用程序的方法以 及一些当前的系统状态。 Usually displayed in the status bar at the bottom of the window to prompt the user to use the programs methods and some of the current system state. 3-2.5 3-2.5 菜单菜单 设置菜单和工具栏属性设置菜单和工具栏属性编写菜单脚本编写菜单脚本 在PowerBar工具栏上单击“New”按 钮,在打开的“New”对话框中选 “PB Object”选项卡,选中 “Menu”图标,单击“OK”按钮, 出现菜单画板。 在“File”菜单中选“Save As” 项,指定菜单名保存后,菜单标题 变为菜单名。在“Insert”菜单中 选“Submenu Item”插入一个新的 子菜单项。 创建菜单创建菜单 开一 个工 作空 间并 指定 当前 目标 3-2.5 3-2.5 菜单菜单 Set menus and Set menus and toolbars propertiestoolbars properties The preparation of The preparation of the menu scriptthe menu script The PowerBar toolbar, click “New“ button to open the “New“ dialog box, selected “PB Object“ tab, select “Menu“ icon, click “OK“ button, the menu that appears drawing board. In the “File“ menu, selected “Save As .“ item, specify the menu name is saved, the menu name of the title into the menu. In the “Insert“ menu, selected “Submenu Item“ Insert a new sub-menu item. Create MenuCreate Menu To open a work space and specify the immediat e objective of 3-2.5 3-2.5 菜单菜单 设置菜单和工具栏属性设置菜单和工具栏属性编写菜单脚本编写菜单脚本创建菜单创建菜单 lMenu画板的属性窗格有两个标签,它们就是用来设置当前被选中的菜单项的各种属 性。 l在“General”标签页中,“Name”为菜单项名字,“Text”为菜单项文本, “MicroHelp”为该菜单项显示在窗口底部状态条上的帮助信息。复选框“Visible” 表示可见性、“Enabled”为可用性、“Checked”为选中状态。 l在“Shortcut”下拉列表中可以选择快捷键,这些快捷键可
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年及未来5年中国花生休闲食品市场运行态势及行业发展前景预测报告
- 团体心理辅导保密协议书6篇
- 2025贵州省文化和旅游厅所属事业单位第十三届人博会引进人才3人模拟试卷带答案详解
- 供应链风险预警-第35篇-洞察与解读
- 2025湖南益阳市资阳区教育系统下属学校公益性岗位招聘10人考前自测高频考点模拟试题及答案详解(各地真题)
- 2025北京协和医院麻醉科合同制科研助理招聘模拟试卷及答案详解(夺冠系列)
- 2025年河北衡水冀州区公开招聘留置保障队伍辅警人员12名模拟试卷及答案详解参考
- 2025安徽淮南联合大学招聘硕士研究生及以上人才14人模拟试卷及完整答案详解一套
- 2025年河北石家庄教联高级职业中学公开招聘工作人员45名考前自测高频考点模拟试题及答案详解(各地真题)
- 班组安全生产培训目的课件
- 水利工程水利工程施工技术规范
- 创建平安医院课件
- 2025年高压电工考试题库:基础理论知识要点
- 2025中证金融研究院招聘11人考试参考题库及答案解析
- 2025年全国中小学校党组织书记网络培训示范班在线考试题库及答案
- 商场保安礼仪培训课件
- 全国2025年质量月活动知识竞赛题库及答案
- 金税四期培训
- 现浇空心板桥梁施工方案
- 托管班安全培训课件
- 人教版(2024)八年级上册英语Unit 2 Home Sweet Home教案
评论
0/150
提交评论