TrainerNotes.doc

上传人:pu****.1 文档编号:561086907 上传时间:2023-04-10 格式:DOC 页数:21 大小:82KB
返回 下载 相关 举报
TrainerNotes.doc_第1页
第1页 / 共21页
TrainerNotes.doc_第2页
第2页 / 共21页
TrainerNotes.doc_第3页
第3页 / 共21页
TrainerNotes.doc_第4页
第4页 / 共21页
TrainerNotes.doc_第5页
第5页 / 共21页
点击查看更多>>
资源描述

《TrainerNotes.doc》由会员分享,可在线阅读,更多相关《TrainerNotes.doc(21页珍藏版)》请在金锄头文库上搜索。

1、PML2Training NotesWhats New in PML2Objects and Object methodsForm names are now preceded with !i.e. setup form _fredfollowed by : setup form !fredresults in an error because !fred was already defined in the previous assignmentForms are now loaded dynamicallyreturn error noalertallows an error to be

2、returned without any messagesWhat to avoid in PML2Commands with dollars in $m- $m+ $W25Numbered variables $v1-120The var command var !x name var !x readSynonymsGlobal variablesWhat to avoid in forms and menusDots in gadget namesselector gadgetsUserdataPixmap viewsAlert gadgetsRadiogroupsSimple Texti

3、n gadgetsNumbers at the beginning of gadget namesWaiton to show formsDo list/pane/selWhats not changed in PML2In theory, all old PML should work in PDMS11.1. Very little of the old appware has been converted because this would be a waste of resources. Cadcentre policy on converting appware to use ne

4、w facilities is to only upgrade appware when modifications are being made in that area.The only exception to this, is where new facilities in core code supersede or improve functionality and it is necessary to write new code to use the extra functionality.New Environment VariablesPMLLIB/DIRECTORYNAM

5、EThis is a directory which is searched when the system looks for functions and forms PMLTRACEON/OFFWhen set to ON, PMLTRACE will display a trace of all macros called in the unix command shell. This can also be switched on or off on the command line, so it is probably better to set the variable to of

6、f and use commands to control trace as before.The command in PDMS is -PML TRACE ON/OFFPMLCOMPILE ON/OFFEnvironment variable PMLDEBUG ON will write a trace fileAvailable variable types$v1old style not recommended!aNamed variables both global and local !global !localNOTE: !a is evaluated as text autom

7、atically by using $!A (early evaluation)Named variables are now typed variables as one of the followingSTRINGText in quotes or vertical bars up to a Max of 254? charREALAny numberBOOLEANTRUE,FALSEThese are not text i.e. TRUE,FALSEARRAYAny type including arrays of arrays of anythingOBJECTSA collectio

8、n of different variables under a user defined typeVariables can be predefined as a particular type or revert to type when they are setThere are two ways of setting variablesVar !a (25) !a is a string!a = 25!a is a real!a = xyz!a is a string!a1 = 75!a1 is a real element of array !a Note: other elemen

9、ts in the same array can be of any type!a = TRUE!a is BOOLEANBeware Pre version 11 the var command was used to set all variables and it produced a string. Now we dont use var apart from collections.Variables may also be created before they are used using Methods!Answer = real()!textline = String()!t

10、est = boolean()!squares = array()All of the above have the value unset There are various ways of testing whether a variable exists or is set:If(undefined(!x)thenIf(defined(!x)thenIf(unset(!x)thenIf(!x.unset()thenIf(set(!x)thenIf(!x.set()thenTo make a variable undefined i.e. empty it.!x.delete()var !

11、x delete Arraysarrays may be sparse i.e. you can set in index order Negative subscripts are not permittedA subscript of zero can be used but is not adviseddo loop from and to variables can now include expressions and even functionsArray methods!arraysize = !arraything.size() Replaces var !arraysisze

12、 (arraysize(!arraything)Sets the variable arraysize to the number of elements in the array!testarray.clear()Deletes all elements from !testarray!test.removefrom(5, 20)Removes 20 elements from element number 5!new = !test.removefrom(5,20)Removes 20 elements as above and creates a new array with the 2

13、0 elements inside.!myarray.append(!newdata)acts like var !array append fhjffj!myarray.27.delete()Deletes element 27 of the array the array still exists!myarray.delete()Deletes the array entirely!line = this is a line of text with some funny spaces !line = !line.trim(lrm) trims the spaces from the va

14、riable called !line!line = this is a line of text with some funny spaces !lines = !line.split(!line) Splits the string !line into an array of strings called !lines.Note: we could not use the same variable name because it is a different type!a = !lines.size() gives the number of elements in the array

15、!a = !lines.width()gives the number of characters in the longest word of the arrayNo result methods.!lines.sort() sorts the array !lines and returns the array in its sorted form!lines.invert()inverts the array order first to last etc. These methods work only on the original array. Attempts to set another array results in an error.i.e. !

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 大杂烩/其它

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