pml编程 唐涌涛

上传人:pu****.1 文档编号:567948796 上传时间:2024-07-22 格式:PPT 页数:82 大小:883KB
返回 下载 相关 举报
pml编程 唐涌涛_第1页
第1页 / 共82页
pml编程 唐涌涛_第2页
第2页 / 共82页
pml编程 唐涌涛_第3页
第3页 / 共82页
pml编程 唐涌涛_第4页
第4页 / 共82页
pml编程 唐涌涛_第5页
第5页 / 共82页
点击查看更多>>
资源描述

《pml编程 唐涌涛》由会员分享,可在线阅读,更多相关《pml编程 唐涌涛(82页珍藏版)》请在金锄头文库上搜索。

1、PML编程语言编程语言CADCENTRE 唐涌涛唐涌涛 CADCENTRE 亚太区亚太区 技术支持工程师技术支持工程师CADCENTRE课程安排课程安排课程安排课程安排上午开始时间:上午开始时间:()上午结束时间:上午结束时间:()中间休息时间:中间休息时间:()课程安排课程安排下午开始时间:下午开始时间:()下午结束时间:下午结束时间:()中间休息时间:中间休息时间:()请示意我暂停课程请示意我暂停课程.您有问题要问您有问题要问您觉得我讲得太快您觉得我讲得太快CADCENTREPML Forms and Menus PML窗体和菜单窗体和菜单 培训内容培训内容sMacros - 什么是什么是

2、Macros (宏)?如何使用它?(宏)?如何使用它?sPML - Programmable Macro Language 可编程宏语言可编程宏语言 (两部分两部分)sPML1 - PML第一版包括第一版包括 loops(循环)(循环), if 语句,语句,string handling(字符串处理)(字符串处理), labels(标识)等(标识)等 PML2 - 基于基于 PML1的面向对象语言的面向对象语言 ,并扩展了类似于,并扩展了类似于 C+, Smalltalk的对象工具的对象工具sForms大多数应用都由大多数应用都由Forms(窗体)和(窗体)和 Menus(菜单)(菜单) 来驱

3、动。大多数来驱动。大多数PML 都是基于都是基于 Form.CADCENTREPML Programmable Macro LanguagePML 可编程宏语言可编程宏语言sMacros是包含是包含PDMS 命令序列的命令序列的ASCII文件文件sProgrammable macros (可编程宏)是包含程序语(可编程宏)是包含程序语句如句如IF statements(IF语句)语句) 和和 Do loops(DO 循循环)环)的宏的宏sMacros 在在 PDMS 中通过中通过 $m /FILENAME来执行来执行s在在 macro line中任何额外位当做为中任何额外位当做为paramet

4、ers(参(参数)数)$M/BUILDBOX 100 200 300 意味着宏文件名后的额意味着宏文件名后的额外的外的3个值被当做为参数个值被当做为参数1 2 和和 3 ,这可在,这可在 macro中中用来设置用来设置PDMS 属性或作为计算属性或作为计算CADCENTREPML2 功能更强大的语言功能更强大的语言sPML2 更象其它现代型语言更象其它现代型语言s典型的是在典型的是在 PML2中需要更少的代码行中需要更少的代码行s更容易编写和阅读更容易编写和阅读s大多数大多数 PML1 编写的宏仍可在编写的宏仍可在 PML2中运行中运行sPML2 包含许多包含许多PML1所没有的功能所没有的功

5、能CADCENTREPML 2 术语术语OOPMETHODSObjectsFunctionsObject BlocksPMLLIBVariable TypesTooltipsFramesRgroups.pmlfnc.pmlfrm.pmlobjCADCENTREPML2的新功能的新功能s新的变量类型新的变量类型 - STRING, REAL, BOOLEAN,ARRAYs内置内置 Methods 用作一般的执行用作一般的执行s新的新的 Global Functions(全程函数)(全程函数) 替代了老式的宏替代了老式的宏s用户自定义的用户自定义的 Object Types(对象类型)(对象类型)

6、s新的新的 PML 搜索路径搜索路径 (PMLLIB)s动态调用动态调用 Forms, Functions 和和 Objectss新的几何建模的新的几何建模的Aid objects(辅助对象)(辅助对象)CADCENTRE一个简单的一个简单的 MacroNEW EQUIP /FREDNEW BOXXLEN 300 YLEN 400 ZLEN 600NEW CYL DIA 400 HEI 600 CONN P1 TO P2 OF PREV一个宏仅仅是包含一些命令的一个文件一个宏仅仅是包含一些命令的一个文件 To run a macro: ASCII 文件文件MYFILE$M/MYFILECADC

7、ENTRE用用 PML与与Cadcentre产品的信息传递产品的信息传递s所有命令都需以字符串的形式传给命令解释器所有命令都需以字符串的形式传给命令解释器.s提取一个提取一个PML 变量值,并赋给一个字符串变量值,并赋给一个字符串 在变量前加在变量前加 $例如:例如: !CompType = ELBO !dist = 5600 NEW $!CompType DIST $!distCADCENTRENEW EQUIP /$1NEW BOXXLEN $2 YLEN $3 ZLEN $4NEW CYL DIA $3 HEI $4 CONN P1 TO P2 OF PREVMacros can be

8、parameterised To run a macro with parameters: ASCII 文件文件MYFILE$M/MYFILE FRED 300 400 600 一个简单的一个简单的 Macro ,继续,继续,CADCENTREMore on macrossMacros 可以有多达可以有多达 9 个由空格分隔的参数个由空格分隔的参数.$M/FRED HARRY IS DEAD 55 66 77 88 99 00 s文本字符串可以以单个参数输入文本字符串可以以单个参数输入$M/FRED $ 55 66 77 88 99 00 s$ 是分隔符,在它们之间的任何东西都被认为是单个参数

9、是分隔符,在它们之间的任何东西都被认为是单个参数CADCENTRESynonyms同义词同义词sSynonyms 是较长命令的缩写,它们可以如下建立:是较长命令的缩写,它们可以如下建立:$SXXX=NEW ELBO SELECT WITH STYP LR ORI P1 IS NsSynonyms 可以参数化可以参数化$SYYY=NEW BOX XLEN $S1 YLEN $S2 ZLEN $S3 执行这个同义词:执行这个同义词: YYY 100 300 2000CADCENTRESynonyms同义词,继续,同义词,继续,sSynonyms 可以递归可以递归!s例如:要修改一些例如:要修改一些

10、 components(元件)参数(元件)参数 6 的值的值 Commands PARAM N6 462 NEXT SYNONYM $SXXX=PARAM N6 462 $/ NEXT $/ XXX注注: $/ 是一个是一个 RETURN CHARACTERs$SXXX= 终止一个终止一个synonym,$sk终止所有的终止所有的 synonyms s$S- 和和 $S+ 关闭和开启同义词功能关闭和开启同义词功能CADCENTREExercise 1CADCENTREVariables变量变量sNumbered Variable types.各种变量类型各种变量类型var 1 name var

11、 2 hello var 3 (99) var 4 (99 * 3 / 6 + 0.5)var 117 pos in sitevar 118 (name of owner of owner)var 119 hello + world + how are you CADCENTREVariables变量变量sNamed variables变量名变量名!variablename or !variablename单个单个 ! 是是local variable(局部变量)(局部变量)两个两个 ! 是是 global variable(全程变量)(全程变量)s变量名可以多达变量名可以多达 16 个字符,

12、变量名可以包含个字符,变量名可以包含 alpha字符和数字字符和数字s变量名不能用数字开头变量名不能用数字开头s变量名不能用变量名不能用.开头开头CADCENTRESetting named variables设置变量名设置变量名VAR !FRED NAMETakes the current elements (ce) name把当前元件的名称赋给变量VAR !POS POS IN WORLDTakes ce position relative to world coordinates把当前元件的绝对坐标值赋给变量VAR !x NAME把文本字符串NAME赋给变量注: 单引号 或 | | 可以

13、用作文本分隔符CADCENTRESetting named variables设置变量名设置变量名VAR !temp (23 * 1.8 + 32)Calculate a value using the expression把表达式的计算值赋给变量VAR !list coll all elbo for ceMakes a string array of database references产生一个字符串数组CADCENTREVariable types变量类型变量类型sThere are four basic variable types:有有4种基本的变量类型种基本的变量类型STRINGA

14、NY ALPHA NUMERIC CHARACTERSREALANY NUMERIC VALUEBOOLEANTRUE /FALSE T/F (not 0 1)ARRAYANY COMBINATION OF THE ABOVECADCENTRECreating Variables新建变量新建变量建立一个建立一个LOCAL(局部变量局部变量), STRING variable:(字符串变量):(字符串变量) !Name = Fred建立一个建立一个GLOBAL(全程变量全程变量), REAL variable: (数字变量(数字变量 ) !Answer = 42 建立一个建立一个GLOBAL(全

15、程变量全程变量), BOOLEAN variable: (逻辑变量)(逻辑变量) !Flag = TRUE 建立一个空的建立一个空的LOCAL ARRAY (局部数组变量)(局部数组变量) !Values = ARRAY() !newarray1 = |xxx| or !newarray1 = xxx CADCENTRECreating Variables新建变量新建变量在在 PDMs command line(命令行命令行)中中,为了提取变量值为了提取变量值, 常常用常常用 $ VAR !XLEN (1000) VAR !YLEN (1000) VAR !ZLEN (1000)NEW BOX

16、 XLEN $!XLEN YLEN $!YLEN ZLEN $!ZLENCADCENTREEXPRESSIONS 表达式表达式s用用 PML 变量的计算表达式变量的计算表达式The PML1 way is: VAR !Z ( $!X + $!Y ) 注注: 在这种情况下在这种情况下 !Z 是是 STRING variable(字符串变量字符串变量)The PML2 way is !Z = !X + !Y注注: 在这种情况下在这种情况下 !Z 是是 REAL variable (数字变量数字变量),并且并且 !X 和和!Y 必须是数字必须是数字CADCENTREExpression Exampl

17、es表达式例子表达式例子sExpression operators表达式操作符表达式操作符+ - / *LT GT EQ NE GT GENOT AND ORSIN COS TAN SQR POW NEGATE ASIN ACOS ATAN LOG ALOG ABS INT NINT!s = 30 * sin(45)!t = pow(20,2) raise 20 to the power 2 (=400)!f = (match(name of owner,LPX)gt 0)CADCENTREOPERATOR PRECIDENCE()* /+ -EQ NE GT LT GE LENOT ANDO

18、R (60 * 2 / 3 + 5) = 45CADCENTREPML 2 Expressions Continued.sPML 2 可以有任意复杂的表达式可以有任意复杂的表达式s可以包含对可以包含对PML Functions 和和 Methods的调用的调用s可以包含可以包含 Form gadget values ,object members 和和methods. For example:!NewVal = !MyFunc(!OldVal) * !Form.Gadget.Val / !MyArray.Method()CADCENTRE在表达式中使用变量在表达式中使用变量s在在 PML2 表

19、达式中当要使用变量值时表达式中当要使用变量值时,不需用不需用$ 和和 括括号号: !X = 64替代替代 VAR !X (64) !Y = 32 !Z = !X + !Ys以下是以下是 PML1 表达式表达式,仍然有效仍然有效: VAR !Z ( $!X + $!Y )注注: !Z 是是 STRING variable (字符串变量字符串变量)CADCENTREArrays 数组数组!x1 = Hello var !x2 World!y1 = fred !y2 = cup!z1 = !x!z2 = !yq var !z12 worldq var !z22 cups 一个数组可以包含许多值一个数

20、组可以包含许多值,每个值叫做一个数组元素每个值叫做一个数组元素s一个数组将通过建立它的一个数组元素而自动建立一个数组将通过建立它的一个数组元素而自动建立s一个数组元素本身也可以是一个数组一个数组元素本身也可以是一个数组: Multi - dimensional Arrays(多维数组多维数组)CADCENTREExercise 2CADCENTREDO !loopcounter FROM 10 TO 100 BY 2some pml codeENDDODO some pml codeBreak condition!ENDDODo loops (Do 循环循环)BREAK IF (!COUNT

21、GT 12)IF (!X EQ !Y) THEN BREAKENDIFCADCENTREDo loops continued有可能在执行部分循环时有可能在执行部分循环时,跳出循环跳出循环,用用skip 命令命令DO some pml codeSKIP condition!ENDDOSKIP IF (!COUNT GT 12)IF(!X = !Y)THEN SKIPENDIFCADCENTREDo Loops ContinuedsDo Index 和和 Do Values 是针对数组循环是针对数组循环.DO !X values !ARRAY!X 提取每个数组元素提取每个数组元素ENDDODO !

22、X Index !ARRAY!X takes a number from 1 to !ARRAY sizeENDDOCADCENTREDo Loops 例子例子var !Zones collect all zones for sitevar !name eval name for all from !ZonesDO !x values !name OR DO !x index !name$!x $!name$!xnew text name $!x-AAA new text name $!name$!x-AAAENDDO ENDDOCADCENTREIf Statements (If 语句语句)

23、sThe if statement is a construct for conditional execution of commands. If语句是有条件地执行命令语句是有条件地执行命令The simplest form of the if construct.IF ( expression ) THEN PDMS CommandsENDIFCADCENTREIf Statements (If 语句语句)IF ( expression ) THENPDMS CommandsELSEIF ( expression ) THENPDMS CommandsELSEPDMS Commands E

24、NDIFselseif 命令是可选项命令是可选项,一旦一旦它的值是它的值是TRUE, 其余语句其余语句都将被忽略都将被忽略.selse 命令也是一个可选项命令也是一个可选项, you can be sure that exactly one command within the if construct will be executed.你可确保你可确保在在IF结构中一条命令将正确结构中一条命令将正确执行执行CADCENTREBranching 分支分支sPML 用用golabel提供从宏的一部分跳转到另一部分提供从宏的一部分跳转到另一部分.LABEL /FRED . 最长最长 16 个字符个

25、字符, 不包括不包括(/) PDMS Commands GOLABEL /FRED 下一行将执行以下命令下一行将执行以下命令LABEL /FRED, 它可以在它可以在GOLABEL command前或后前或后.CADCENTREConditional Jumping 条件跳转条件跳转LABEL /FRED PDMS Commands GOLABEL /FRED IF ( expression ) More PDMS Commands 如果表达式是如果表达式是 TRUE 将跳转到将跳转到 LABEL /FRED 如果表达式是如果表达式是FALSE, PML 将执行将执行the More PDMS

26、 Commands CADCENTREConditional Jumping 条件跳转条件跳转Do !A$P Processing $!A do !B to 10 !C = !A * !B golabel /finished if (!C GT 100) $P Product $!C enddoenddolabel /finished$P Finished with processing = $!A Product = $!CCADCENTREExercise 3CADCENTREErrors & Error Handling出错处理出错处理出错是由于一个命令不能顺利完成或者在出错是由于一个命

27、令不能顺利完成或者在macro 或或 function中有错误中有错误.出错通常有三种结果出错通常有三种结果:s出现一个警告框出现一个警告框,用户必须确认用户必须确认.s输出一个错误信息输出一个错误信息.s当前运行的当前运行的 PML macros 和和 fuctions 退出退出CADCENTREExample of an Errors出错的例子出错的例子当试图使用一个并不存在的当试图使用一个并不存在的PML变量时的出错信息变量时的出错信息:(46,28) ERROR - Variable FRED not defined. 46 是是 错误出现在哪个错误出现在哪个Module 或或prog

28、ram section 28 是错误本身代码是错误本身代码.CADCENTREError Handling出错处理出错处理If the input line was part of a PML macro or function the error may optionally be HANDLED.a command causes Error(46, 27)handle (46, 27)Handle block - not processed this timeelsehandle (46, 27)The commands in this matching Handle Block are

29、processed nextContd over .CADCENTREError Handling Contdelsehandle anyAn ANY Handle Block is processed for any errors. In this position it would handle errors other (46, 27) and (46,28) elsehandle NONEA NONE Handle Block is processed only if there were no errorsendhandle This line is processed after

30、the handle block CADCENTRE新的新的 & 联接操作符联接操作符s通过通过 & 联接的值将自动转换成字符串联接的值将自动转换成字符串. 以下这个例子是把以下这个例子是把 !Z 设为字符串设为字符串 6432mm !X = 64 !Y = 32 !m = mm !Z = !X & !Y & !m !ans.append(!c & in Centigrade is & !f & in Fahrenheit)s把把 !Z 设为数值设为数值 96 !X = 64 !Y = 32 !Z = !X + !YCADCENTREs新的新的 PMLLIB 环境变量指向一个目录结构环境变量指

31、向一个目录结构s3 个新的文件扩展名个新的文件扩展名 .pmlfnc .pmlfrm .pmlobjsPML2 functions 函数调用及运行函数调用及运行:call !mymac() 运行文件运行文件 mymac.pmlfnc PML2 Functions Forms and Objectspmllibfunctionsformsxxx.pmlfncxxx.pmlfrmobjectsxxx.pmlobjCADCENTREThe !CE Objects一个特殊的一个特殊的PML GLOBAL variable(全程变量(全程变量 )!CE 常常是指向当前的常常是指向当前的PDMS元件及它的

32、属性元件及它的属性: !BranchHeadBore = !CE.Hbore !HeadPosition = !CE.Hposition !Easting = !HeadPosition.Easts相对于其它元件的位置:相对于其它元件的位置: !PosWRTValve = !HeadPosition.WRT(!Valve)CADCENTREPML2 Functions函数函数sFunctions 是一种新型的是一种新型的macros,通过调用它的名字来执,通过调用它的名字来执行行- call !FunctionName() sFunctions 有自变量并且可以返回一个结果值:有自变量并且可以

33、返回一个结果值: define function !Area(!Radius is REAL) is REAL !CircleArea = !Radius.Power(2) * 3.142 or ( PI) return !CircleArea endfunctionsFunctions 也可用在表达式中也可用在表达式中 : !CylinderVolume = !Area(2.3) * !Height注意注意: 在函数中,在函数中,Synonyms 同义词需关闭同义词需关闭CADCENTREObjects, Forms 和和 Functions 的动态调用的动态调用s当第一次使用时,当第一次使

34、用时,PML 将从文件中自动调用将从文件中自动调用Object 或或 FORM : !Person = object PRIMEMINISTER() show !MyInputForms重新定义了重新定义了 object 要调用它要调用它:pml reload form !MyInputForm pml reload object PRIMEMINISTER()s进入进入PDMS 后,要使增加的新文件生效:后,要使增加的新文件生效: pml rehash allCADCENTREExercise 4CADCENTRE使用使用 Methods s一旦定义一旦定义, 变量不能改变其类型变量不能改变

35、其类型.s为了转换变量类型,可以用为了转换变量类型,可以用methods.!x = 56 creates a string variable!y = (!x.real() * 2)creates a real using !x methods 也可用作比较也可用作比较.If (!x.real() eq 56) then s其它的转换其它的转换 methods 是是string() 和和 boolean() !zz = !x.real() 用字符串变量用字符串变量!x 建立一个新的数值变量建立一个新的数值变量!zzCADCENTREMethod 的并用的并用sMethods 可以并用可以并用!l

36、ine = hello world how are you!newline = !line.upcase().split().sort()q var !newline 1 ARE 2 HELLO 3 HOW4 WORLD 5 YOUCADCENTRE逻辑表达式和逻辑表达式和IF语句语句s基于象基于象EQ和和GT这样的逻辑运算符的表达式,会产生一个逻辑值,这样的逻辑运算符的表达式,会产生一个逻辑值,这个值可以用在这个值可以用在PML中中. if ( !Value GT 999 ) or ( !Value EQ 999 ) then !Test = TRUE elseif ( !Value LT

37、999 ) then !Test = FALSE endif CADCENTRE逻辑表达式和逻辑表达式和IF语句语句s表达式可以仅仅是一个变量表达式可以仅仅是一个变量: !Success = !Value GT 0 if ( !Success ) thens表达式可以是用户自定义的函数表达式可以是用户自定义的函数“它能返回一个逻辑它能返回一个逻辑值值” if ( !MyFunction() ) thenCADCENTREConverting a value to BOOLEAN把一个值转换成逻辑变量把一个值转换成逻辑变量s有一个内置的有一个内置的PML method 和和 function 可

38、用来把一个值转换可用来把一个值转换成逻辑变量成逻辑变量: !MyString = TRUE if ( !MyString.Boolean() ) then .CADCENTREAlert Objectss有三种类型的无返回值的有三种类型的无返回值的 alert :!Alert.Error( You cannot do this! )!Alert.Message( Saving your data now )!Alert.Warning( Do not press this button again! )s缺省情况,缺省情况,By default, all alert forms appear

39、with the relevant button as near to the cursor as possible. To position an alert specifically, X and Y values can be specified as a proportion of the screen size!Alert.Error( You cannot do this! , 0.25, 0.1)CADCENTREAlert ObjectsCADCENTREAlert Objects continued.sThere are three types of alert which

40、return a value, confirm, question and input alerts.Confirm Alerts!Answer = !Alert.Confirm( Are you sure! )Confirm alerts return YES or NO as stringsQuestion Alerts!Answer = !Alert.Question( OK to delete Site? )Answer alerts return YES or NO or CANCEL as stringsCADCENTREAlert Objects continued.Input

41、Alerts!Answer = !Alert.Input( Enter Width of Floor,10 )The first value is the prompt and the second is the default value. Input alerts return a value as a string. CADCENTREForms Are Global ObjectssForms and Form Gadgets now look like global variables.sQuerying a form can be done by: q var !formnameT

42、his has the effect of listing all of the form attributes and all of its gadget members sQuerying a gadget can be done in a similar way:q var !formname.gadgetnameq var !formname.gadgetname.valCADCENTREForm Definition. setup form !myform Title My Form Title Icontitle Myform !myform.initcall = !this.in

43、it() . exit define method .init() . endmethodCADCENTREShowing and hiding FormssThe Searchpath mechanism means that pre-loading each form is no longer necessary.sTo show a form use:show !formname This will load the form definition and show it in one go!sSometimes it is usefull to have the form loaded

44、 so you can use the forms gadgets to store data.sTo load a form and not show it:loadform !formnameCADCENTREBuilt-in methods for FormssA variety of useful method calls have been provided:sTo show a form: !Myform.Show()sTo hide a form: !Myform.Hide()sTo query whether a form is currently shown: if ( !M

45、yform.Shown() ) then : endifCADCENTREForm GadgetssThere are many kinds of form gadgets as you will see on the following slides.sWhen you are defining gadgets on a form, there are two common aims. Define the area to be taken up on the formDefine the action to be taken if the gadget is selectedsEach g

46、adget size and position determines the area taken upsThe action is defined by the gadgets CALLBACKCADCENTREBuilt-in methods for GadgetssGadgets are objects with members and a variety of useful built-in method calls:sTo grey-out a gadget: !Myform.GadgetName.Active = FALSEsTo move the keyboard focus t

47、o a gadget: !Myform.GadgetName.SetFocus()CADCENTRECallbackssAny selectable gadget has a callback which is defined at the time the gadget is created. sThe callback can do one of three things:show a formexecute a command directlyrun a function or methodbutton .opt |Options| call |show !optionsform| bu

48、tton .del |Delete| call |delete equipment|button .apply |Apply| call |!Myfunction()button .apply |Apply| call |!this.MyMethod()|CADCENTREForm Callbacks (Initcall)sThe forms initialisation callback allows the forms gadgets to be initialised to reflect the current state of the application.sYou can set

49、 the callback by assigning to the forms initcall member: INITCALL CallbackstringsOr directly by !MyForm.initcall = CallbackstringNote: The callback must attempt to display another form.CADCENTREForm Callbacks (OK)sThe OKCALL callback allows the operator to approve the current gadget settings.sYou ca

50、n assign to the forms OKCALL member using the command, OKCALL CallbackstringsYou can modify the Ok callback at any time using,!this.Okcall = CallbackstringCADCENTREForm Callbacks (Cancel)sThe CANCELCALL callback allows the operator not to proceed with the functions of the form.sYou can assign to the

51、 forms CANCELCALL member using the command, CANCELCALL CallbackstringsYou can modify the Cancel callback at any time using,!this.Cancelcall = CallbackstringCADCENTRE A Simple Form. setup form !hello Title My Form Title Icontitle Myform SG specific paragraph .Message text Hello world button .bye Good

52、bye OK exitCADCENTREGadget PositioningsGadgets are positioned on a form from top leftForm OriginGadget OriginCADCENTREsEach Gadget has four label points XMIN, XMAX YMIN YMAXsThese can be used for positioningAt Xmin .apply Ymax - 0.5at yminat xmax .frame1 + 4sTo position a gadget in the bottom right

53、of the form, use-at xmax form - sizeGadget positioning contdYMINYMAXXMINXMAXCADCENTREsRelative to the Last Gadget Toggle .OnOff at XMIN YMAX+1 Relative Gadget PlacementCADCENTREsRelative to Specific Prevoius Gadgets Toggle .OnOff at XMIN .Gadget1-size YMAX .Gadget1 +1 Relative Gadget PlacementCADCEN

54、TREGadget PlacementsThe path command can be used to define the logical position of subsequent gadgets.PATH DOWN means that the next gadget will be below the current one, PATH RIGHT means that the next gadget will be to the right of the current one.s The spacing between gadgets is controlled by VDIST

55、 and HDIST for vertical and horizontal spacing.sFinally if desperation calls! There are settings of HALIGN and VALIGN which can set the alignment LEFT,RIGHT,TOP and BOTTOM.CADCENTREGadget PlacementCADCENTREParagraph GadgetssParagraph gadgets are simple named gadgets which allow a piece of text or a

56、PIXMAP to be displayed on a form.Para .cwd at 0 0 Text Current DirectoryThis is a paragraph gadgetCADCENTREButtonsButton .Button Pop Form FORM !PopForm Button .Calculate Calculate Callback !MyFunctionName()Button .Apply Apply Callback !MyFunction()Button .ok OK Callback !MyFunction() OKButton .cance

57、l Cancel Callback !MyFunction() CANCELButton .reset Reset Callback !MyFunction() RESETButton .help Help Callback !MyFunction() HELPButton .dismiss Dismiss okCADCENTREFramesA Frame is a cosmetic gadget which is used to surround a group of similar gadgets.The syntax is:FRAME .MYFRAME AT 0 3 My FrameBU

58、TTON .B1 Press HereBUTTON .B2 Or Press HereEXITCADCENTREText Entry GadgetssA text input gadget provides a place on a form into which the user may type a value.Text .DirName callback !This.TopDir() AT X 0 Width 50 is StringThis is a text entry gadgetCADCENTREList GadgetssA list gadget allows the user

59、 to make a single or multiple choice from many alternatives.List .SubDirs Sub Dirs CallBack !This.SDirs() Width 60 Hei 4List .Files |Teams| Width 60 Hei 9This is a list gadgetCADCENTRETextpane GadgetssA TEXTPANE gadget provides an area on a form into which a user may edit multiple lines of text, cut, paste from elsewhere on the PML screen.Textpane .textp MyTextpane at x3y6 width 50 hei 6This is a textpaneCADCENTREExercise 5CADCENTREButtonss Change the background colour of a button:!Workbench.Apply.Background = 2 sAdd a picture to a button:Button .Apply pixmap /c:/pml/aveva.bmp

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 文学/艺术/历史 > 人文/社科

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号