Home

CIMPLICITY HMI Program Editor Operation Manual

image

Contents

1. Preface Contents of this Manual Chapter 1 Introduction Gives a brief description of CIMPLICITY the Basic Control Engine option and the Program Editor Chapter 2 About the Program Editor Gives a functional overview of the Program Editor and describes window components menu functions toolbars and shortcut keys Chapter 3 Editing Programs Shows you how to navigate within a script insert select delete cut and paste text add comments and find and replace text Chapter 4 Editing Custom Dialog Boxes Shows you how to use the Dialog Editor to create and modify custom dialog boxes Chapter 5 Debugging Your Scripts Shows you how to use the Debugger to trace script execution set and remove breakpoints and use a watch variable Chapter 6 Running Your Programs Shows you how to start suspend and stop a program Appendix A Runtime Error Messages Lists the runtime error codes and their associated messages Appendix B Compiler Error Messages Lists the compiler error codes and their associated messages Related Publications For more information refer to these publications CIMPLICITY HMI Plant Edition Base System User Manual GFK 1180 CIMPLICITY HMI Plant Edition Basic Control Engine Language Reference Manual GFK 1283 CIMPLICITY HMI Plant Edition Event Editor Operation Manual GFK 1282 GFK 11S80K iii Contents GFK 11S80K Introduction 1 1 CIMPLIC ILY PumctOnality cjg isa cS etennci a A 1 1 Ba
2. A 4 GFK 1305D Index errors list of language elements 1 8 executing scripts in Program Editor pausing execution of 6 1 starting execution of 6 1 stopping execution of 6 1 tracing execution of 5 2 5 3 exiting from Dialog Editor 4 33 exiting from Dialog Editor 4 33 E file system list of language elements 1 9 files list of language elements 1 9 financial functions list of 1 10 Functional Overview Program Editor 2 1 G grid in Dialog Editor 4 11 4 12 group boxes in Dialog Editor 4 8 H help in Dialog Editor 4 6 4 45 Information dialog box in Dialog Editor 4 15 4 18 ini files list of language elements 1 11 inserting text in Program Editor 3 3 insertion point moving in Program Editor 3 1 to specified line 3 2 with mouse 3 1 3 2 InterScript Calls Program Editor 2 3 K keyboard shortcuts in Dialog Editor 4 5 Index ili L line continuation in Program Editor 3 9 list boxes in Dialog Editor 4 8 logical operators list of 1 11 math functions list of 1 11 Menu Functions Program Editor 2 5 menus reference for in Dialog Editor 4 34 4 45 messages runtime error A 2 A 4 moving controls in Dialog Editor 4 20 dialog boxes in Dialog Editor 4 20 Multiple Threads of Execution Program Editor 2 3 N numeric operators list of 1 12 O objects list of language elements 1 12 OK buttons in Dialog Editor 4 7 option buttons in Dialog Editor 4 7 4 13 4 32 P parsing list of
3. Cancel Variable Name Text PushButton Identifier PushButtont CIMPLICITY HMI Program Editor Operation Manual July 2001 GFK 1305D Attributes That You Can Adjust with the Dialog Box Information Dialog Box The following lists show the attributes that you can change with the Dialog Box Information dialog box for the various controls In some cases specified below it s mandatory to fill in the fields in which the attributes are specified that is you must either leave the default information in these fields or replace it with more meaningful information but you can t leave the fields empty In other cases filling in these fields is optional that is you can either leave the default information in the fields replace it with more meaningful information or leave the fields entirely empty Note A quick way to determine whether it s mandatory to fill in a particular Information dialog box field is to see whether the OK button becomes grayed out when you delete the information in that field If it does then you must fill in that field In many cases you could simply leave the generic sounding default information in the Information dialog box fields and worry about replacing it with more meaningful information after you paste the dialog box template into your script However if you take a few moments to replace the default information with something specific when you first create your dialog box not only will you save yo
4. E Ln Col O Pause Compiled READ For Help press F1 The main window contains the Menu bar and the Standard and Tools toolbars Each script window contains its own Debug toolbar A script window contains three areas These are in order from top to bottom e Watch window e Script window e Trace window These areas can be resized by dragging the separators CIMPLICITY HMI Program Editor Operation Manual July 2001 GFK 1305D Program Editor Menu Functions You can use the menu options to open close print and compile files to edit a file to run a file to debug a file to access tools to view status and toolbars to arrange windows and access help The File Menu When you select the File menu the following drop down list is displayed New Open Dave Save All Save AS Print Print Preview Ctrl 0 Cr z Ctrl P 1 GACIMPLICITY onchange bel 2 GACIMPLICITY search bel 3 GACIMPLICITY 4 dialogs2 bel 4 GACIMPLICITY 4 dialogs bel Compile Create Program Exit The File menu functions are New Open Save Save All Print Print Preview Recent File Compile Create Program Exit GFK 1305D About The Program Editor Creates a new document for the Program Editor Opens an existing document for the Program editor Saves the active document Saves all the open files in the Program Editor Prints the active document Displays the active document as it will be pr
5. Here s how to place on the Clipboard text that you have cut from your script e Press Ctrl X The selection is removed from your script and placed on the Clipboard Copying A Selection Here s how to place on the Clipboard text that you have copied from your script e Press Ctrl C The selection remains in your script and a copy of it is placed on the Clipboard Once you have cut or copied material to the Clipboard here s how to paste it into your script at another location 1 Position the insertion point where you want to place the contents of the Clipboard 2 Press Ctrl V The contents of the Clipboard appear at the location of the insertion point If you wish to delete a block of text and insert the contents of the Clipboard in its place you can combine the two operations by first selecting the text you want to remove and then pressing Ctrl V to replace it with the contents of the Clipboard Undoing Editing Operations GFK 1305D You can undo editing operations that produce a change in your script including e The insertion of a series of characters e The insertion of a block of text from the Clipboard e The deletion of a series of characters e The deletion or cutting of a block of text You cannot undo operations that don t produce any change in your script such as moving the insertion point selecting text and copying material to the Clipboard Here s how to reverse the effect of the preceding editing operation
6. command to move the instruction pointer to another line within that subroutine 1 Place the insertion point in the line where you want to resume stepping through the script 2 From the Debug menu choose the Set Next Statement command The instruction pointer moves to the line you selected and you can resume stepping through your script from there Note You can only use the Set Next Statement command to move the instruction pointer within the same subroutine CIMPLICITY HMI Program Editor Operation Manual July 2001 GFK 1305D Setting and Removing Break points If you want to start the debugging process at the first line of your script and then step through your code line by line until you reach the end of the code that you need to debug the method described in the preceding subsection works fine But if you only need to debug one or more portions of a long script that method can be pretty cumbersome An alternate strategy is to set one or more breakpoints at selected lines in your script Program Editor suspends execution of your script just before it reaches a line containing a breakpoint thereby allowing you to begin or resume stepping through the script from that point Setting Breakpoints You can set breakpoints to begin the debugging process partway through your script to continue debugging at a line outside the current subroutine and to debug only selected portions of your script Valid breakpoints can only be s
7. e Press Ctrl Z Your script is restored to the way it looked before you performed the editing operation You can undo the last 100 operations Editing Programs 3 7 Adding Comments to Your Script 3 8 CIMPLICITY HMI Program Editor Operation Manual July 2001 You can add comments to your script to remind yourself or others of how your code works Comments are ignored when your script is executed The apostrophe symbol is used to indicate that the text from the apostrophe to the end of the line is a comment Adding A Full Line Comment Here s how to designate an entire line as a comment 1 Type an apostrophe at the start of the line 2 Type your comment following the apostrophe When your script is run the presence of the apostrophe at the start of the line will cause the entire line to be ignored Adding An End of Line Comment Here s how to designate the last part of a line as a comment 1 Position the insertion point in the empty space beyond the end of the line of code 2 Type an apostrophe 3 Type your comment following the apostrophe When your script is run the code on the first portion of the line will be executed but the presence of the apostrophe at the start of the comment will cause the remainder of the line to be ignored Although you can place a comment at the end of a line containing executable code you cannot place executable code at the end of a line containing a comment because
8. 3 If the desired topic is not already highlighted on the second list select it and press Enter Help is displayed for the topic you selected CIMPLICITY HMI Program Editor Operation Manual July 2001 GFK 1305D Creating a Custom Dialog Box GFK 1305D This section describes the types of controls that Dialog Editor supports It also explains how to create controls and initially position them within your dialog box and offers some pointers on creating controls efficiently In the next section Editing a Custom Dialog Box you ll learn how to make various types of changes to the controls that you ve created moving and resizing them assigning labels and accelerator keys and so forth Types of Controls Dialog Editor JIM ous Cancel L PushButton Dialog lt g Y 20 Width 218 Height 131 Dialog Editor supports the following types of standard Windows controls all of which are illustrated in the above dialog box Push button Push button is a command button The default OK and Cancel buttons are special types of push buttons Option button Option button is one of a group of two or more linked buttons that let users select only one from a group of mutually exclusive choices A group of option buttons works the same way as the buttons on a car radio because the buttons operate together as a group clicking an unselected button in the group selects that button and automatically deselects the previously se
9. 3276 CIMPLICITY HMI Program Editor Operation Manual July 2001 Error Message OLE Automation object does not exist Access to OLE Automation object denied OLE initialization error OLE Automation method returned unsupported type OLE Automation method did not return a value Object doesn t support this property or method placeholder OLE Automation argument type mismatch placeholder OLE Automation error placeholder OLE Automation Object does not have a default value Invalid ordinal Invalid Clipboard format Can t empty clipboard Can t open clipboard Set value not allowed on collections Get value not allowed on collections ODBC SQLAITlocEnv failure ODBC SQLAllocConnect failure ODBC SQLFreeConnect error ODBC SQLAlTlocStmt failure Invalid SQL statement expected DELETE INSERT PROCEDURE SELECT or UPDATE ODBC call failed ODBC connection failed Invalid database ID GFK 1305D Basic Control Engine Specific Error Messages The Basic Control Engine specific error messages are GFK 1305D Error Number 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 Error Message Incorrect Windows version Too many dimensions Can t find window Can t find menu item Another queue is being flushed Can t find control Bad channel number Requested data not available Can t create pop up menu
10. Basic and the second describing error messages specific to the Basic Control Engine A few error messages contain placeholders which get replaced by the runtime when forming the completed runtime error message These placeholders appear in the following list as the italicized word placeholder A I Visual Basic Compatible Error Messages The Visual Basic compatible error messages are Error Number 3 5 6 J 9 10 11 13 14 19 20 26 28 35 48 49 51 52 53 54 55 57 58 59 61 62 63 64 67 68 70 71 Error Message Return without GoSub Illegal procedure call Overflow Out of memory Subscript out of range This array is fixed or temporarily locked Division by zero Type mismatch Out of string space No Resume Resume without error Dialog needs End Dialog or push button Out of stack space Sub or Function not defined Error in loading DLL Bad DLL calling convention Internal error Bad file name or number File not found Bad file mode File already open Device I O error File already exists Bad record length Disk full Input past end of file Bad record number Bad file name Too many files Device unavailable Permission denied Disk not ready A 2 CIMPLICITY HMI Program Editor Operation Manual July 2001 GFK 1305D Error Number 74 75 76 91 93 94 139 140 141 143 144 150 163 260 281 282 283 285 286 287 288 289 290 291 292 295 298 429 430 431 432
11. E leant at rscuas ides ucatate necatas nuseainect 4 2 Sims The Dios EdilO serria E ea e 4 3 Dialog Editor s Application W1IndOW sese see ee eee 4 3 Keyboard Shortcuts for Dialog Editor sss sese 4 5 Usima R S T TTT 4 6 Creating a Custom Dialog BOS x sg VRE C ZER OER AE ERE Eaa oga 4 7 TYPES OL COTO Sass onscciznendeaisancasendsanntessensacdi sachoassesseaentacentensancectisaduarct EE 4 7 Adding Controls to a Dialog BOX miiie Naa ORN ne ea niae 4 9 Using the Grid to Help You Position Controls within a Dialog Box 06 4 11 Creating Controls Eficient L 4 12 Editing a Custom Dialog BOX okassea rr AN OA aa a SN 4 14 SClECHNG L TTT a aa cues ita aon 4 14 Using the Information Dialog BOX 4 15 Attributes That You Can Adjust with the Dialog Box Information Dialog Box 4 17 Attributes That You Can Adjust with the Information Dialog Box for a Control 4 18 Changing The Position or an We tmisieias eicciscevtok na scones EA 4 19 Chansine the Siz Of an en era wstale miveoonabennbar niches E 4 21 Changing Titles and Labels ergiini i EEA 4 22 ASSIOTING Accelerator Key Sminia a a a nN 4 22 Specifying PICture S sacar a TTT 4 24 Creating or Modifying Picture Libraries under WImdOWS sss 4 25 Duplicating and Deleting Controls sese eee 4 26 Undoing S PH E E ETT 4 27 EBditine an Existing Dialog E 4 28 Pasting an Existing Dialog Box into Dialog Editor 4 28 Capturing a Dialog Box from Another Application eee eee eee eee 4 29 Openi
12. Error Message Can t rename with different drive Path File access error Path not found Object variable or With block variable not set Invalid pattern string Invalid use of Null Only one user dialog may be up at any time Dialog control identifier does not match any current control The placeholder statement is not available on this dialog control type The dialog control with the focus may not be hidden or disabled Focus may not be set to a hidden or disabled control Dialog control identifier is already defined This statement can only be used when a user dialog is active No timer available No more DDE channels No foreign application responded to a DDE initiate Multiple applications responded to a DDE initiate Foreign application won t perform DDE method or operation Timeout while waiting for DDE response User pressed Escape key during DDE operation Destination is busy Data not provided in DDE operation Data in wrong format Foreign application quit DDE conversation closed or changed Message queue filled DDE message lost DDE requires ddeml dll OLE Automation server can t create object Class doesn t support OLE Automation OLE Automation server cannot load file File name or class name not found during OLE Automation operation GFK 1305D Appendix A Runtime Error Messages A 3 A 4 Error Number 433 434 435 436 437 438 439 440 443 452 460 520 521 600 601 603 604 608 610 3129 3146 3148
13. Message box canceled Command failed Network error Network function not supported Bad password Network access denied Network function busy Queue overflow Too many dialog controls Can t find list box combo box item Control is disabled Window is disabled Can t write to ini file Can t read from ini file Can t copy file onto itself OLE Automation unknown object name Can t redimension a fixed array Can t load and initialize extension Can t find extension Unsupported function or statement Can t find ODBC libraries OLE Automation Lbound or Ubound on non Array value Incorrect definition for dialog procedure Appendix A Runtime Error Messages A 5 Error Message List GFK 1305D Appendix B Compiler Error Messages The following table contains a list of all the errors generated by the Basic Control Engine compiler With some errors the compiler changes placeholders within the error to text from the script being compiled These placeholders are represented in this table by the word placeholder 2 3 A 5 6 7 8 10 11 12 13 14 15 18 19 20 21 22 Variable Required Can t assign to this expression Letter range must be in ascending order Redefinition of default type Out of memory too many variables defined Type character doesn t match defined type Expression too complex Cannot assign whole array Assignment variable and expression are different types Array type mismatch in parameter Array type
14. a group of two or more linked buttons that let users select only one from a group of mutually exclusive choices 9 Check box Adds a check box to your dialog box Users can check or clear a check box to indicate their preference regarding the alternative specified on the check box label GFK 1305D Editing Custom Dialog Boxes 4 43 Group box T Text Text box List box Combo box Drop list box Picture MAEI Picture button Adds a group box to your dialog box A group box is a rectangular design element used to enclose a group of related controls You can use the optional group box label to display a title for the controls in the box Adds a text control to your dialog box A text control is a field containing text that you want to display for the users information The text in this field wraps and the field can contain a maximum of 255 characters Text controls can either display stand alone text or be used as labels for text boxes list boxes combo boxes drop list boxes pictures and picture buttons You can choose the font in which the text appears Adds a text box to your dialog box A text box is a field into which users can enter text potentially as much as 32K By default this field holds a single line of nonwrapping text If you choose the Multiline setting in the Text Box Information dialog box this field will hold multiple lines of wrapping text Adds a list box to your dialog box A list
15. an octal string Convert a number to a string Convert a string to a number GFK 1305D GFK 1305D Data types Boolean Currency Date Double Integer Long Object Single String Variant Database SQLBind SQLClose SQLError SQLExecQuery SQLGetSchema SQLOpen SQLRequest SQLRetrieve SQLRetrieveToFile Date time Date Date functions Date Date statements DateAdd DateDiff DatePart DateSerial DateValue Introduction Data type representing True of False values Data type used to hold monitary values Data type used to hold dates and times Data type used to hold real number with 15 16 digits of precision Data type used to hold whole numbers with 4 digits of precision Data type used to hold whole numbers with 10 digits of precision Data type used to hold OLE automation objects Data type used to hold real number with 7 digits of precision Data type used to hold sequences of characters Data type that holds a number string or OLE automation objects Specify where to place results with SQLRetrieve Close a connection to a database Return error information when an SQL function fails Execute a query on a database Return information about the structure of a database Establishes a connection with a database Run a query on a database Retrieve all or part of a query Retrieve all or part of a query placing results in a file Return the current date Change the system date Ad
16. and execute multiple Visual Basic programs concurrently Both the Program Editor and the Visual Basic compliant language are documented in this manual For more information on the Event Editor see the CIMPLICITY HMI Event Editor Operation Manual GFK 1282 GFK 1305D Using the Basic Control Engine Language Reference GFK 1305D The Basic Control Engine Language Reference Manual is organized like a dictionary containing an entry for each language element The language elements are categorized as follows Category data type function keyword operator statement topic Description Any of the support data types such as Integer String and so on Language element that takes zero or more parameters performs an action and returns a value Language element that doesn t fit into any of the other categories Language elements that cause an evaluation to be performed either on one or two operands Language element that takes zero or more parameters and performs an action Describes information about a topic rather than a language element Each entry in the Basic Control Engine Language Reference Manual contains the following headings Heading Description Syntax The syntax of the language element The conventions used Description Comments Example See Also in describing the syntax are described in Chapter 1 of the Basic Control Engine Language Reference Manual Contains a one line description of that
17. characters selected text or entire lines from your script e To remove a single character to the left of the insertion point press Backspace once to remove a single character to the right of the insertion point press Delete once To remove multiple characters hold down Backspace or Delete e To remove text that you have selected press Backspace or Delete e To remove an entire line place the insertion point in that line and press Ctrl Y Deleting Line Breaks Here s how to remove an unwanted line break from your script 1 Place the insertion point after the last character on the current line 2 Press Delete once to delete the hidden end of line character The current line and the following line are combined Or 1 Place the insertion point at the start of a line 2 Press Backspace The current line and the preceding line are combined Note If any spaces were entered at the end of the current line you may have to press Delete one or more additional times to remove these hidden characters first before you can delete the end of line character Pressing Backspace with the insertion point at the start of a line has no effect that is it will not combine the current line with the preceding line CIMPLICITY HMI Program Editor Operation Manual July 2001 GFK 1305D Cutting and Copying Text Pasting Text You can place material from your script on the Clipboard by either cutting it or copying it Cutting A Selection
18. code that is about to be executed that is the line that will be executed next if you either proceed with the debugging process or run your script at full speed When the instruction pointer is on a line of code the text on that line appears in black on a gray background that spans the width of the entire line The following illustration shows the difference between the instruction pointer and the selection highlight discussed in the preceding section in which the text appears in white on a black or blue background that spans only the width of the selected text search becl redim matches Olddir curdir create default file patterns Case ebNetWare DEFAULT FILESPEG HLH Case ebHMacintosh ebSolaris ebSun0OS ebHPUX ebUltrix e DEFAULT FILESPEC ebs Case ebWint ebWin3 ebOs ebDOS16 ebDbos32 Ln 110 Col 12 Pause Compiled READ GFK 1305D 5 1 Fabricating Event Information 5 2 The Event Editor allows the user to configure a script to run in response to an event When a project is running the Event Manager runs a script either when a specified event or any event occurs depending on what is specified in the script However on one hand when you build the script in the Program Editor there is no real event to trigger the script On the other hand when the script runs with the Event Manager you can t debug it in the program editor Therefore the Program Editor provides you with an Event Inf
19. create a new picture library to contain the Windows bitmaps or metafiles that you want to display on picture controls or picture button controls in your dialog box 1 Create a C file containing the minimal code required to establish a DLL The following code can be used include lt windows h gt int CALLBACK LibMain HINSTANCE hInstance WORD wDataSeg WORD wHeapSz LPSTR lpCmdLine UnlockData 0 return 1 2 Use the following code to create a DEF file for your picture library LIBRARY DESCRIPTION My Picture Library EXETYPE WINDOWS CODE LOADONCALL MOVABLE DISCARDABLE DATA PRELOAD MOVABLE SINGLE HEAPSIZE 1024 GFK 1305D Editing Custom Dialog Boxes 4 25 3 Create a resource file containing your images The following example shows a resource file using a bitmap called sample bmp and a metafile called usa wmf define METAFILE 256 USA METAFILE usa wmft MySample BITMAP sample bmp 4 Create a make file that compiles your C module creates the resource file and links everything together To modify an existing picture library Here s how to modify an existing picture library to contain the Windows bitmaps or metafiles that you want to display on picture controls or picture button controls in your dialog box 1 Make a copy of the picture library you want to modify 2 Modify the copy by adding images using a resource editor such as Borland s Resource Workshop or Microsoft s App Studio Note Wh
20. depending on a condition 1 5 Main Return Select Case Sleep Stop Switch While Wend Define a subroutine where execution begins Continue execution after the most recent GoSub Execute one of a series of statements Pause for a specified number of milliseconds Suspend execution returning to a debugger if present Return one of a series of expressions depending on a condition Repeat a group of statements while a condition is True Controlling the operating environment Command Command Environ Environ Conversion Asc CBool CCur CDate CDbl Chr Chr CInt CLng CSng CStr CVar CV Date CVErr Hex Hex IsDate IsError IsNumeric Oct Oct Str Str Val CIMPLICITY HMI Program Editor Operation Manual July 2001 Return the command line Return a string from the environment Return the value of a character Convert a value to a Boolean Convert a value to Currency Convert a value to a Date Convert a value to a Double Convert a character value to a string Convert a value to an Integer Convert a value to a Long Convert a value to a Single Convert a value to a String Convert a value to a Variant Convert a value to a Date Convert a value to an error Convert a number to a hexadecimal string Determine if an expression is convertible to a date Determine if a variant contains a user defined error value Determine if an expression is convertible to a number Convert a number to
21. dialog box Adds a push button to your dialog box Adds an option button to your dialog box Adds a check box to your dialog box Adds a group box to your dialog box Adds a text control to your dialog box Adds a text box to your dialog box Adds a list box to your dialog box Adds a combo box to your dialog box Adds a drop list box to your dialog box Adds a picture to your dialog box Adds a picture button to your dialog box The types of dialog box controls that you can add with the control tools are fully described in the next section of the chapter 4 4 CIMPLICITY HMI Program Editor Operation Manual July 2001 GFK 1305D GFK 1305D Keyboard Shortcuts for Dialog Editor The following keyboard shortcuts can be used for some of the operations you will perform most frequently in Dialog Editor Key s Alt F4 Ctrl C Ctrl D Ctrl G Ctrl l Ctrl V Ctrl X Ctrl Z Del F1 F2 F3 Shift F1 Function Closes Dialog Editor s application window Copies the selected dialog box or control without removing it from Dialog Editor s application window and places it on the Clipboard Creates a duplicate copy of the selected control Displays the Grid dialog box Displays the Information dialog box for the selected dialog box or control Inserts the contents of the Clipboard into Dialog Editor If the Clipboard contains script statements describing one or more controls then Dialog Editor adds those contro
22. dialog box moves to that position If you left the X coordinate blank the dialog box will be centered horizontally relative to the parent window of the dialog box when the dialog box is run If you left the Y coordinate blank the dialog box will be centered vertically relative to the parent window of the dialog box when the dialog box is run To reposition a control with the Information dialog box Here s how to move a selected control by changing its coordinates in the Information dialog box for that control 1 Display the Information dialog box for the control that you want to move 2 Change the X and Y coordinates in the Position group box 3 Click the OK button or press Enter The control moves to the specified position Note When you move a dialog box or control with the arrow keys or with the Information dialog box the item s movement is not restricted to the increments specified in the grid setting When you attempt to test a dialog box containing hidden controls 1 e controls positioned entirely outside the current borders of your dialog box Dialog Editor displays a message advising you that there are controls outside the dialog box s borders and asks whether you wish to proceed with the test If you proceed the hidden controls will be disabled for testing purposes Testing dialog boxes is discussed later in the chapter 4 20 CIMPLICITY HMI Program Editor Operation Manual July 2001 GFK 1305D Changing the Size o
23. displayed on it Note Windows metafiles always expand or contract proportionally to fit within the picture control or picture button control containing them In contrast windows bitmaps are of a fixed size If you place a bitmap in a control that is smaller than the bitmap the bitmap is clipped off on the right and bottom If you place a bitmap in a control that is larger than the bitmap the bitmap is centered within the borders of the control Picture controls and picture button controls must be resized manually GFK 1305D Editing Custom Dialog Boxes 4 21 Changing Titles and Labels By default when you begin creating a dialog box its title reads Untitled and when you first create group boxes option buttons push buttons text controls and check boxes they have generic sounding default labels such as Group Box and Option Button To change a dialog box title or a control label Here s how to change the title of your dialog box as well as the labels of group boxes option buttons push buttons text controls and check boxes 1 Display the Information dialog box for the dialog box whose title you want to change or for the control whose label you want to change 2 Enter the new title or label in the Text field Note Dialog box titles and control labels are optional Therefore you can leave the Text field blank 3 If the information in the Text field should be interpreted as a variable name rather than a liter
24. field holds a single line of nonwrapping text If you choose the Multiline setting in the Text Box Information dialog box this field will hold multiple lines of wrapping text Note Group boxes text controls and pictures are passive elements in a dialog box inasmuch as they are used purely for decorative or informative purposes Users cannot act upon these controls and when they tab through the dialog box the focus skips over these controls List box List box is a displayed scrollable list from which users can select one item The currently selected item is highlighted on the list Combo box Combo box is a text field with a displayed scrollable list beneath it Users can either select an item from the list or enter the name of the desired item in the text field The currently selected item is displayed in the text field If the item was selected from the scrolling list it is highlighted there as well CIMPLICITY HMI Program Editor Operation Manual July 2001 GFK 1305D GFK 1305D Drop list box Drop list box is a field that displays the currently selected item followed by a downward pointing arrow which users can click to temporarily display a scrolling list of items Once they select an item from the list the list disappears and the newly selected item is displayed in the field Picture Picture is a field used to display a Windows bitmap or metafile Note Group boxes text controls and pictures are passive elements
25. for Points Edit Point Edit Point ID New Point Create a new Point Get Point Get Point Value Set Point Set a Point Dim Point Dimension a Point Object Gen Alarm Generate an Alarm Update Alarm Update an Alarm Log Status Log a status message Dynamic Toggle Dynamic Configuration Application Toolbar The Application Toolbar functions are En LL et et SE I Start Break End Compile Toggle Breakpoint QuickWatch Add Watch Call Stack Step Into Step Modify Toggle Trace Clear Trace Command Line About The Program Editor Start or continue execution Interrupt execution End execution Compile the document Set or clear a breakpoint Quickwatch a variable Add a watch to a variable Display call stack Step into the current line Step over the current line Modify the value of a variable Enable Disable Tracing Clear the contents of the trace window Set the command line for the script 2 11 Program Editor Shortcut Keys You can use the following shortcut keys to initiate commonly used functions 2 12 Ctrl N Ctrl O Ctrl S Ctrl P Ctrl Z Ctrl X Ctrl C Ctrl V Delete Ctrl F F3 Ctrl G Ctrl D Shift F9 F8 Shift F8 F9 F5 CIMPLICITY HMI Program Editor Operation Manual July 2001 Creates a new document Opens an existing document Saves the active document Prints the active document Undoes the last edit action Cuts the selection and puts it on the Clipboard Copies the selection and puts
26. in a dialog box inasmuch as they are used purely for decorative or informative purposes Users cannot act upon these controls and when they tab through the dialog box the focus skips over these controls You can obtain a Windows bitmap or metafile from a file or from a specified library Picture button Picture button is a special type of push or command button on which a Windows bitmap or metafile appears Note You can obtain a Windows bitmap or metafile from a file or from a specified library Adding Controls to a Dialog Box In this subsection you ll learn how to create controls and determine approximately where they first appear within your dialog box In the following subsection you ll learn how to determine the positioning of controls more precisely Here s how to add one or more controls to your dialog box using simple mouse and keyboard methods Editing Custom Dialog Boxes 4 9 Adding A Control You can only insert a control within the borders of the dialog box you are creating You cannot insert a control on the dialog box s title bar or outside its borders To add a control 1 From the toolbar choose the tool corresponding to the type of control you want to add 2 Place the pointer where you want the control to be positioned and click the mouse button Note When you pass the mouse pointer over an area of the display where a control can be placed the pointer becomes an image of the selected con
27. language element Contains any other important information about that language keyword Contains an example of that language keyword in use An example is provided for every language keyword Contains a list of other entries in the Reference section that relate either directly or indirectly to that language element Introduction Language Elements by Category The following subsections list Basic Control Engine language elements by Clipboard Clipboard function Clipboard statement Clipboard Clear Clipboard GetFormat Clipboard GetText Clipboard SetText Comments Rem category Arrays ArrayDims Return the number of dimensions of an array ArraySort Sort an array Erase Erase the elements in one or more arrays LBound Return the lower bound of a given array dimension Option Base Change the default lower bound for array declarations ReDim Re establish the dimensions of an array UBound Return the upper bound of a dimension of an array Return the content of the clipboard as a string Set the content of the clipboard Clear the clipboard Get the type of data stored in the clipboard Get text from the clipboard Set the content of the clipboard to text Comment to end of line Add a comment Comparison operators lt lt lt gt CIMPLICITY HMI Program Editor Operation Manual July 2001 Less than Less than or equal to Not equal Equal Greater than Greater than or equal to GFK 1305D GFK 1
28. language elements 1 12 pasting text in Script Editor 3 7 picture buttons in Dialog Editor 4 9 picture controls in Dialog Editor 4 9 picture libraries creating or modifying 4 25 4 26 pictures specifying in Dialog Editor 4 24 4 25 printing list of language elements 1 13 procedures list of language elements 1 13 tracing calls of in Program Editor 5 4 Program Editor 3 1 Breakpoints 2 2 comments adding to script 3 8 dialog box templates editing for use in 3 13 Dialog Editor 2 3 Functional Overview 2 1 Getting Started 2 3 insertion point moving 3 1 to specified line 3 2 with mouse 3 1 3 2 instruction pointer 5 1 moving to another line in subroutine 5 4 InterScript Calls 2 3 Menu Functions 2 5 Multiple Threads of Execution 2 3 On Line Help 2 3 QuickWatch 2 2 scripts checking syntax of 3 12 navigating within 3 3 2 pausing execution of 6 1 running 6 1 stopping execution of 6 1 tracing execution of 5 2 5 3 selection highlight 3 4 Shortcut Keys 2 12 statements continuing on multiple lines 3 9 Step In 2 2 Step Over 2 2 text copying 3 7 cutting 3 7 deleting 3 6 inserting 3 3 pasting 3 7 replacing 3 11 searching for 3 10 selecting 3 4 3 5 Toolbars 2 10 Trace Window 2 2 undoing editing operations 3 7 Watch Window 2 2 Window Components 2 4 Wizards 2 1 Program Editor Menus Debug Menu 2 7 Edit Menu 2 6 File Menu 2 5 Help Menu 2 9 Run Menu 2 7 Tools Menu 2 8 View Menu 2 8 Windows Menu 2 9 Index i
29. of option buttons into a single group click the Run tool to end the test and then use the Option Button Information dialog box to assign the same Option Group name for all the buttons that you want included in that group e Text box functioning Can you enter only a single line of nonwrapping text or can you enter multiple lines of wrapping text If the text box doesn t behave the way you intended click the Run tool to end the test then display the Text Box Information dialog box and select or clear the Multiline check box e Accelerator keys If you have assigned an accelerator Key to a text control or group box in order to provide user access to a text box list box combo box drop list box or group box do the accelerator keys work properly That is if you press Alt the designated accelerator key does the insertion point move into the text box or group box or to the currently selected item in the list box combo box or drop list box If the accelerator key doesn t work properly it means that the text box list box combo box drop list box or group box is not associated with the text control or group box to which you assigned the accelerator key that is in your dialog box template the description of the text control or group box does not immediately precede the description of the control s that should be associated with it As with tabbing order problems discussed above you can fix this problem by using a simple cut and
30. paste technique to adjust the order of the control descriptions in your template First click the Run tool to end the test then cut the text control or group box from the dialog box and immediately paste it back in again and finally do the same with each of the controls that should be associated with the text control or group box The controls will now appear in the desired order in your template and the accelerator keys will work properly 4 32 CIMPLICITY HMI Program Editor Operation Manual July 2001 GFK 1305D Pasting a Dialog Box Template into Your Script Dialog boxes and dialog box controls are communicated between Dialog Editor and your script via the Clipboard where they are represented as statements Here s how to copy a dialog box or control and paste it into your script 1 Select the dialog box or control that you want to incorporate into your script 2 Press Ctrl C 3 Open your script and paste in the contents of the Clipboard at the desired point The dialog box template or control is now described in statements in your script as shown in the following example Basicl Sub Maing Begin Dialog UserDialog 162 58 Untitled OKButton 116 8 456 4 CancelbButton 116 28 46 174 CheckBox 8 455 8 CheckBox CheckBox Checkbox 20 455 8 Checkbox CheckBox Pushbutton 8 392 48 174 PushButton PushButtont End Dialog Dim d As UserDialog Dialog d End Sub L into 0 ie _ Exiting from Dialog Edi
31. pictures 4 24 from file 4 24 from picture library 4 24 4 25 Index ti CIMPLICITY HMI Program Editor Operation Manual July 2001 GFK 1305D tabbing order of 4 12 4 29 4 32 text boxes 4 8 4 32 text controls 4 8 types of 4 7 4 9 Dialog Editor 2 3 4 1 4 2 See also dialog boxes in Dialog Editor dialog controls dialog controls in Dialog Editor user dialogs application window 4 3 Controls menu 4 43 4 44 controls supported by 4 7 4 9 Dialog Translation Errors dialog box 4 29 4 30 Edit menu 4 42 4 43 exiting from 4 33 features of 4 2 File menu 4 41 4 42 grid displaying and adjusting 4 1 1 4 12 help for current window 4 6 on selected topics 4 6 Help menu 4 45 Information dialog box 4 15 4 18 adjusting control attributes with 4 17 4 18 adjusting dialog box attributes with 4 17 displaying for controls 4 16 for dialog boxes 4 15 keyboard shortcuts 4 5 Pick tool 4 45 picture libraries 4 25 4 26 creating for use in 4 25 4 26 modifying for use in 4 26 toolbar of 4 4 undoing editing operations 4 27 dialog procedures actions sent to 4 40 dialogs built in listing of 1 12 drop list boxes in Dialog Editor 4 9 duplicating controls in Dialog Editor 4 26 E editing custom dialog boxes 4 1 4 14 4 27 Editing Program About 3 1 Editing Programs 3 1 environment controlling list of language elements 1 6 error messages BasicScript specific A 5 compatible with Visual Basic A 2 compiler B 1 B 4 runtime A 2
32. press Enter the text control label looks like the following illustration and users will be able to move the insertion point to the currently selected item in the list box by typing Alt F Note In order for such a de facto accelerator key to work properly the text control or group box label to which you assign the accelerator key must be associated with the control s to which you want to provide user access that is in the dialog box template the description of the text control or group box must immediately precede the description of the control s that you want associated with it The simplest way to establish such an association is to create the text control or group box first followed immediately by the associated control s Editing Custom Dialog Boxes 4 23 4 24 Specifying Pictures In the preceding section you learned how to add picture controls and picture button controls to your dialog box But these controls are nothing more than empty outlines until you specify the pictures that you want them to display A picture control or picture button control can display a Windows bitmap or metafile which you can obtain from a file or from a specified library Refer to the following subsection for information on creating or modifying picture libraries under Windows To specify a picture from a file Here s how to display a Windows bitmap or metafile from a file on a picture control or picture button control by using the co
33. should return a 0 or idle processing will use up the CPU 6 This action is sent when the dialog box is moved You ll find a more complete explanation of these action codes in the A Z Reference See the DlgProc Function entry in that chapter 4 40 CIMPLICITY HMI Program Editor Operation Manual July 2001 GFK 1305D Menu Tools Reference File Menu The File menu commands are Keyboard Shortcut Menu Toolbar Command Tool New Open Save Save As Test Dialog F5 Capture Dialog Exit Alt F4 Editing Custom Dialog Boxes Function Creates a new dialog box Dialog Editor prompts you before discarding any changes you have made to your current dialog box Displays the Open Dialog File dialog box which you can use to open an existing dialog box template Dialog Editor prompts you before discarding any changes you have made to your current dialog box If you have already created a file for the current dialog box template saves the template to that file If you have not yet created a file for the current dialog box template displays the Save Dialog File dialog box which you can use to specify the file to which you want to save the current template Displays the Save Dialog File dialog box which you can use to save the current dialog box template in a file under a new name Toggles between the run mode in which the dialog box comes alive for testing purposes and the edit mode in which
34. the presence of the apostrophe at the start of the comment will cause the balance of the line including the code to be ignored GFK 1305D Breaking a Statement across Multiple Lines GFK 1305D By default in Program Editor a single statement can extend only as far as the right margin and each line break represents a new statement However you can override this default if you want to break a long statement across two or more lines Here s how to indicate that two or more lines of code should be treated as a single statement when your script is run 1 Type the statement on multiple lines exactly the way you want it to appear 2 Place the insertion point at the end of the first line in the series 3 Press the spacebar once to insert a single space 4 Type an underscore _ Note The underscore 19 the line continuation character which indicates that the statement continues on the following line 5 Repeat steps 2 4 to place a line continuation character at the end of each line in the series except the last When you run your script the code on this series of lines will be executed as a single statement just as if you had typed the entire statement on the same line Editing Programs 3 9 Searching and Replacing Program Editor makes it easy to search for specified text in your script and automatically replace instances of specified text Finding Text in Your Script Here s how to locate instances of specif
35. the timeout used for non responding applications Return the line with the error Return the error that caused the current error trap Set the value of the error Simulate a trappable runtime error Return the text of a given error Trap an error Continue execution after an error trap GFK 1305D GFK 1305D File I O Close EOF FreeFile Get Input Input Input Line Input Loc Lock Lof Open Print Put Reset Seek function Seek statement UnLock Width Write File system ChDir ChDrive CurDir CurDir Dir Dir DiskDrives DiskFree FileAttr FileCopy FileDateTime FileDirs FileExists FileLen Introduction Close one or more files Determine if the end of file has been reached Return the next available file number Read data from a random or binary file Read data from a sequential file into variables Read a specified number of bytes from a file Read a line of text from a sequential file Return the record position of the file pointer within a file Lock a section of a file Return the number of bytes in an open file Open a file for reading or writing Print data to a file Write data to a binary or random file Close all open files Return the byte position of the file pointer within a file Set the byte position of the file pointer which a file Unlock part of a file Specify the line width for sequential files Write data to a sequential file Change the current directory Change the c
36. the types of information you can control Control s Types of Information List box drop list box and combo box Items Text box Default text Check box Values In the following subsections you ll learn how to define and fill an array set the default text in a text box and set the initial focus and tab order for the controls in your custom dialog box Defining and Filling an Array You can store items in the list box shown in the example above by creating an array and then assigning values to the elements of the array For example you could include the following lines to initialize an array with three elements and assign the names of three common fruits to these elements of your array Dim ListBox1 3 Initialize list box array ListBox1 0 Apples ListBox1 1 Oranges ListBox1 2 Pears Setting Default Text in a Text Box You can set the default value of the text box in your script to 12 with the following statement which must follow the statement that defines the dialog record but precede the statement or function that displays the custom dialog box b TextBoxl 12 Editing Custom Dialog Boxes 4 35 Setting the Initial Focus and Controlling the Tabbing Order You can determine which control has the focus when your custom dialog box is first displayed as well as the tabbing order between controls by understanding two rules that the Basic Control Engine script follows First the focus in a custom dialog
37. use the arrow keys to move the selection highlight to the desired variable Note Pressing F6 again returns the insertion point to its previous position in the edit pane GFK 1305D Debugging Your Scripts 5 9 Deleting a Watch Variable Here s how to delete a selected variable from Program Editor s watch variable list 1 Select the variable on the watch list 2 Press Delete The selected variable is removed from the watch list Modifying the Value of a Variable When the debugger has control you can modify the value of any of the variables on Program Editor s watch variable list Here s how to change the value of a selected watch variable 1 Select the name of the variable whose value you want to modify and press the Modify button or select Modify from the Debug menu Program Editor displays the Modify Variable dialog box Modify Variable Name UK Value Note The name of the variable you selected on the watch variable list appears in the Name field If you want to change another variable you can either enter a different variable in the Name field or select a different variable from the Variables list box which shows the names of the variables that are defined within the current function or subroutine When you use the Modify Variable dialog box to change the value of a variable you don t have to specify the context Program Editor first searches locally for the definition of that variable then privately t
38. you can come to creating controls in the order in which you want them to receive the tabbing focus the fewer tabbing order adjustments you ll have to make later on CIMPLICITY HMI Program Editor Operation Manual July 2001 GFK 1305D GFK 1305D e Option button grouping If you want a series of option buttons to work together as a mutually exclusive group you must create all the buttons in that group one right after the other in an unbroken sequence If you get sidetracked and create a different type of control before you have finished creating all the option buttons in your group you ll split the buttons into two or more separate groups Let s say you want to create an option button group with five buttons You create three of the buttons and then create a list box after which you finish creating the last two buttons When you test your dialog box you ll find that all five of these option buttons don t work together as a mutually exclusive group Instead the first three buttons will form one mutually exclusive group and the last two buttons will form another mutually exclusive group e Accelerator keys As explained later in the chapter you can provide easy access to a text box list box combo box or drop list box by assigning an accelerator key to an associated text control and you can provide easy access to the controls in a group box by assigning an accelerator key to the group box label To do this you must create the text c
39. you can make changes to the dialog box Captures the standard Windows controls from a standard Windows dialog box in another Windows application Closes Dialog Editor Dialog Editor prompts you before discarding any changes you have made to your current dialog box 4 4 Exit amp Alt F4 Closes Dialog Editor and returns Return you to the host application Dialog Editor prompts you before discarding any changes you have made to your current dialog box Edit Menu The Edit menu commands are Menu Toolbar Keyboard Command Tool Shortcut Function Undo Ctrl Z Allows you to undo up to 10 preceding operations The Undo command continually indicates the next operation you can undo by selecting it and grays out when there are no more operations that can be undone Cut Ctrl X Removes the selected dialog box or control from Dialog Editor s application window and places it on the Clipboard Copy Ctrl C Copies the selected dialog box or control without removing it from Dialog Editor s application window and places it on the Clipboard Paste Ctrl V Inserts the contents of the Clipboard into Dialog Editor If the Clipboard contains statements describing one or more controls then those controls are added to the current dialog box If the Clipboard contains the template for an entire dialog box then Dialog Editor creates a new dialog box from the statements in the template If the statements contain errors Dialog
40. 2 8 amp Quantity Textl First control in template gets the focus TextBox 48 4 28 12 TextBoxl ListBox 12 28 68 32 ListBox1 ListBoxl OKButton 112 8 40 14 CancelButton 112 28 40 14 End Dialog Dim b As UserDialog Create the dialog record b TextBoxl 12 Set default value of the text box to 1 dozen response Dialog b Display the dialog box Select Case response Case 1 FruitS ListBox1 b ListBox1 MsgBox Thank you for ordering b TextBoxl Fruit Case 0 MsgBox Your order has been canceled End Select End Sub Editing Custom Dialog Boxes 4 37 Using a Dynamic Dialog Box in Your Script The preceding section explained how you can use a custom dialog box in your script As you learned you can retrieve the values from dialog box controls after the user dismisses the dialog box by referencing the identifiers in the dialog record You can also retrieve values from a custom dialog box while the dialog box is displayed using the dynamic dialog boxes feature The following script illustrates the most important concepts you ll need to understand in order to create a dynamic dialog box in your script Dim Fruits and Vegetables arrays here to make them accessible to all procedures Dim Fruits 2 As String Dim Vegetables 2 As String Dialog procedure must precede the procedure that defines the custom dialog box Function DialogControl ctr1 action suppvalue As Integer Se
41. 305D AppActivate AppClose AppFind AppGetActive AppGetPosition AppGetState AppHide AppList AppMaximize AppMinimize AppMove AppRestore AppSetState AppShow AppSize AppType SendKeys Shell Call Choose Do Loop DoEvents function DoEvents statement End Exit Do Exit For For Next GoSub Goto If Then Else lf Introduction Controlling other programs Activate an application Close an application Return the full name of an application Return the name of the active application Get the position and size of an application Get the window state of an application Hide an application Fill an array with a list of running applications Maximize an application Minimize an application Move an application Restore an application Set the state of an application s window Show an application Change the size of an application Return the type of an application Send keystrokes to another application Execute another application Controlling program flow Call a subroutine Return a value at a given index Execute a group of statements repeatedly Yield control to other applications Yield control to other applications Stop execution of a script Exit a Do loop Exit a For loop Repeat a block of statement a specified number of times Execute at a specific label allowing control to return later Execute at a specific label Conditionally execute one or more statements Return one of two values
42. A FANUC GE Fanuc Automation CIMPLICITY Monitoring and Control Products CIMPLICITY HMI Plant Edition Basic Control Engine Program Editor Operation Manual GFK 1305D July 2001 GFL 005 Following is a list of documentation icons P OT Warning notices are used to emphasize that hazardous voltages currents temperatures or other conditions that could cause personal injury exist in the equipment or may be associated with its use ie 4 Caution provides information when careful attention must be taken in order to avoid damaging results a Important flags important information J4 To do calls attention to a procedure Note calls attention to information that is especially significant to understanding and operating the equipment or software US Tip provides a suggestion VA lan a Guide provides additional directions for selected topics CIMPLICITY is a registered trademark of GE Fanuc Automation North America Inc Windows Windows NT Windows 98 and Windows 2000 are registered trademarks of Microsoft Corporation Visual Basic and Visual Basic for Applications are trademarks of Microsoft Corporation Portions of the Program Editor are copyright 1992 1995 Summit Software This manual was produced using Doc To Help by WexTech Systems Inc Copyright 1998 2001GE Fanuc Automation North America Inc All rights reserved ii CIMPLICITY HMI Program Editor Operation Manual July 2001 GFK 1305D
43. Clipboard 2 Open Dialog Editor 3 Press Ctrl V Dialog Editor adds to your current dialog box one or more controls corresponding to the description contained on the Clipboard 4 28 CIMPLICITY HMI Program Editor Operation Manual July 2001 GFK 1305D Notes When you paste a dialog box template into Dialog Editor the tabbing order of the controls is determined by the order in which the controls are described in the template When you paste one or more controls into Dialog Editor they will come last in the tabbing order following the controls that are already present in the current dialog box If there are any errors in the statements that describe the dialog box or controls the Dialog Translation Errors dialog box will appear when you attempt to paste these statements into Dialog Editor This dialog box shows the lines of code containing the errors and provides a brief description of the nature of each error Capturing a Dialog Box from Another Application Here s how to capture the standard Windows controls from any standard Windows dialog box in another application and insert those controls into Dialog Editor for editing 1 Display the dialog box you want to capture 2 Open Dialog Editor 3 Choose the Capture Dialog command from the File menu Dialog Editor s application window moves behind all other open application windows and the dialog box you displayed in step 1 reappears The mouse pointer previously an arrow now
44. Dialog statement 19 Dialog mydlg Where Dialog is the statement that calls a declared dialog name mydlg is the dialog name in this example 4 36 CIMPLICITY HMI Program Editor Operation Manual July 2001 GFK 1305D GFK 1305D Retrieving Values from the Custom Dialog Box After displaying a custom dialog box for your user your script must retrieve the values of the dialog controls You retrieve these values by referencing the appropriate identifiers in the dialog record You ll find an example of how to retrieve values from a custom dialog box in the following subsection Sample In the following sample script several of the techniques described earlier in this section have been used In this script the array named ListBox 1 is filled with three elements Apples Oranges and Pears The default value of TextBox is set to 12 A variable named response is used to store information about how the custom dialog box was closed An identifier named List Boss is used to determine whether the user chose Apples Oranges or Pears in the list box named List Boss S Finally a Select Case End Select statement is used to display a message box appropriate to the manner in which the user dismissed the dialog box Sub Main Dim ListBox1 2 Initialize list box array Dim response ListBox1 0 Apples ListBox1 1 Oranges ListBox1 2 Pears Begin Dialog UserDialog 163 94 Grocery Order Text 13 6 3
45. Editor displays the Dialog Translation Errors dialog box which helps you pinpoint the location and nature of the errors 4 42 CIMPLICITY HMI Program Editor Operation Manual July 2001 GFK 1305D Delete Delete Removes the selected dialog box or control from Dialog Editor s application window without placing it on the Clipboard If you have selected the dialog box and it contains more than one control Dialog Editor prompts you before removing all the controls from it Duplicate Ctrl D Creates a duplicate copy of the selected control Size to F3 Adjusts the borders of certain Text controls to fit the text displayed on them Info Ctrl I Displays the Information dialog box for the selected dialog box or control You can use this dialog box to check and adjust various attributes of controls and dialog boxes Grid Ctrl G Displays the Grid dialog box which you can use to display or turn off the grid and adjust the grid s spacing Controls Menu The Control menu commands are Menu Toolbar Command Tool Function OK button Adds a default OK button to your dialog box An OK button is a special type of push or command button Cancel button Adds a default Cancel button to your dialog box A Cancel button is a special type of push or command button S DU Push button Adds a push or command button to your dialog box Option button Adds an option button to your dialog box An option button is one of
46. Navigating within SCMpt sisene e ce seule a E Aedes eaten 3 1 Moving the Insertion Point with the Mouse sees eee ee eee 3 1 Moving the Insertion Point to a Specified Line sese sese 3 2 TIS RUNG Fe TTT 3 3 Selena TSX EET 3 4 Selecans Text With the Le 3 4 Selecting Text With the Keyboard sese 3 5 Sclectino A Line With the Keyboard essiri aaar E r aSa E 3 5 RT R N TTT a ate e een calans end eacs 3 6 Delkenne Selected N Web TTT 3 6 ROI E Ene BUCA TTT 3 6 Cutting and Opy ine TEX TTT 3 7 CURIS A a LTTE 3 7 Copy nE A SClECUOM H e h E tan R aa 3 7 BAG LS R T 3 7 Undone Edina Operans T 3 7 Adding Comments to Y our Sept sieren E testi E adie 3 8 Addins A F ll Line Commenter senean a aa a a Ea 3 8 Adding An End of Line Comment sese sese 3 8 CIMPLICITY HMI Program Editor Operation Manual July 2001 GFK 1305D GFK 1180J Breaking a Statement across Multiple Lines sese eee ee eee eee 3 9 Searching and Replace carenar a ine vitae hve Ain eeceaee 3 10 Pinging Pex tl YOUrS Cpls tstcloetainscusetoinweiaieaatasetscemevssbinteraetnss aa 3 10 Replacing Textin Your Sem pt ataa TTia aga HH E ATTAR Taza 3 11 Checkin the S Vmtax Ol aS Chip enori a e Eie E a Oa nat 3 12 Editing Dialog Box Template Se isnnin elieessedechsd aden cessed 3 13 Editing Custom Dialog Boxes 4 1 About Baiting Dialog BOXE Suossa a a a a a A a A 4 1 Overview of Dialog Editor soseri ects ei iec cee oti 4 2 Features Or the Dials E Te ais siscos shea hovestea iee
47. OK button or press Enter 4 Display the Information dialog box for the picture control or picture button control whose picture you want to specify CIMPLICITY HMI Program Editor Operation Manual July 2001 GFK 1305D 5 Inthe Picture source option button group select Library 6 Inthe Name field enter the name of the picture you want to display on the picture control or picture button control This picture must be from the library that you specified in step 2 7 Click the OK button or press Enter The picture control or picture button control now displays the picture you specified Creating or Modifying Picture Libraries under Windows The Picture statement allows images to be specified as individual picture files or as members of a picture library which is a DLL that contains a collection of pictures Currently both Windows bitmaps and metafiles are supported You can obtain a picture library either by creating a new one or by modifying an existing one as described below Each image is placed into the DLL as a resource identified by its unique resource identifier This identifier is the name used in the Picture statement to specify the image The following resource types are supported in picture libraries Resource Type Description 2 Bitmap This is defined in windows h as RT_BITMAP 256 Metafile Since there is no resource type for metafiles 256 is used To create a picture library under Windows Here s how to
48. Toolbars Program Editor 2 10 Trace Window Program Editor 2 2 GFK 1305D Index Index v
49. aeescninadenadededese 1 15 Ke e C 1 15 Contents v Contents vi About The Program Editor 2 1 OGO OV Cry w a chin stan navn o N Rad Ea RAH daai 2 1 Le e defoacinererssosneat na dieser danceiue deere ouaectinarteoerseu se anceeedeaemeusoenacsoecerte 2 1 Watc EW INOW oreas E Sansenastacwonehtanacuateeavonchbaesennseve 2 2 Ouiek W atch Object Inspector deicii n a e a a a a 2 2 TRACE NY WN TTT 2 2 Bie APONEA E E E E E E seaceiasee Reece 2 2 STE WSE DOW CF ennn a n A E O EEE TTO N 2 2 Interscnpt e all Siere E E esses 2 3 M t ple Threadsof Executionissa E a 2 3 Dilor S eenaa ee a ea 2 3 Om enee TTT 2 3 Getin Stare deaa a E E tee a ceex noe uiane aoa 2 3 Program Editor Window COomponentS sss eee eee 2 4 Program Editor Menu Functions cccccccccceccecccccceeeseeseeeeeeeeeeeeeeeeeeeeaeaseesesseeeeeeeeeeeeeeeeaaas 2 5 The Pile Meee eon pag En OEEO EERE NAAS 2 5 The Edit MENU orroe a e a e A 2 6 NG TR Monner a E Me csannanacactenaet oases 2 7 ANG De DUS Te TTT 2 7 The TOO IS VIC 1s tesa ech 8 cacdioat ooacorch O onan beesennseve 2 8 BN View Monien T E E T EE 2 8 PINE WW INGO WIC ce site a a a sate tet te setae aces enetanuenss 2 9 0 HeD T TTT 2 9 Pior Editor T OOM DAM Siesoo a na Ea O 2 10 Standard Toolbar reese a E e A E 2 10 AE oe E A E e 2 11 Applicaton Kaele C 2 11 Prooram Editor SHORCUL T 2 12 Settings String and Stack TTT 2 13 Editing Programs 3 1 ANDOU EONS Prostas cesme na a a a a a a E 3 1
50. al string select the Variable Name check box 4 Click the OK button or press Enter The new title or label is now displayed on the title bar or on the control Although OK and Cancel buttons also have labels you cannot change them The remaining controls text boxes list boxes combo boxes drop list boxes pictures and picture buttons don t have their own labels but you can position a text control above or beside these controls to serve as a de facto label for them Assigning Accelerator Keys Accelerator keys enable users to access dialog box controls simply by pressing Alt a specified letter Users can employ accelerator keys to choose a push button or an option button toggle a check box on or off and move the insertion point into a text box or group box or to the currently selected item in a list box combo box or drop list box An accelerator key is essentially a single letter that you designate for this purpose from a control s label You can assign an accelerator key directly to controls that have their own label option buttons push buttons check boxes and group boxes You can t assign an accelerator key to OK and Cancel buttons because as noted above their labels can t be edited You can create a de facto accelerator key for certain controls that don t have their own labels text boxes list boxes combo boxes and drop list boxes by assigning an accelerator key to an associated text control 4 22 CIMPLICITY HMI P
51. am Editor window Current Programs Displays the list of current programs The Help Menu When you select the Help menu the following drop down list is displayed Index Using Help The Help menu options are Index Displays the main Help window for the Program Editor Using Help Displays the main Help window for Microsoft Windows About Displays program information version number and copyright for the Program Editor About The Program Editor 2 9 Program Editor Toolbars 2 10 The main window contains the Standard and Tools Toolbars In addition each script window contains an Application toolbar Standard Toolbar The Standard Toolbar functions are New Create a new document Open Open an existing document Save Save the active document Save All Save all the open files Cut Cut the selection and put it on the Clipboard Copy Copy the selection and put it on the Clipboard Paste Insert Clipboard contents Cascade Windows Arrange windows so they overlap Tile Horizontally Arrange windows as non overlapping tiles Tile Vertically Arrange windows as non overlapping tiles Print Print the active document About Display program information version number and copyright Bee Emam Z E aae Help Display Help for clicked on buttons menus and windows CIMPLICITY HMI Program Editor Operation Manual July 2001 GFK 1305D Tools Toolbar The Tools Toolbar functions are SHH a a Browse Point Browse
52. atch Shit F9 Delete Yatch Quick atch Modify Step FG step Into ohifttF Call Stack v Trace Clear Trace Toggle Breakpoint FY Clear all Breakpoints Set Next Statement set Command Line Reset Public Variables The Debug menu options are Add Watch Displays the Add Watch dialog box in which you can specify the name of a script variable Delete Watch Deletes the watch from the selected variable Quick Watch Modify Modifies the value of a variable Step Executes the next line of the script If the line calls a procedure the called procedure is run in its entirety Step Into Executes the next line of the script If the line calls a procedure the next line to execute will be the first line of the called procedure Call Stack Displays the stack of current calls Trace Enables disables output to the Trace window About The Program Editor 2 7 Clear Trace Toggle Breakpoint Toggles a breakpoint in the script Clear all Breakpoints Clears all breakpoints from the script Set Next statement Sets the nest statement to be executed in a paused program to the currently selected line Set Command Line Set the command line for the script This can be retrieved via the basic Command parameter The Basic Control Engine will pass the Event amp Action which caused the script to be run See BCE Manual Reset Public Variables Reset s the contents of public and private variables to an empty state The Tools M
53. ation Manual July 2001 GFK 1305D GFK 1305D Selecting Text With the Keyboard Here s how to use keyboard shortcuts to select text in your script 1 Place the insertion point where you want your selection to begin 2 While pressing Shift use one of the navigating keyboard shortcuts to extend the selection to the desired ending point The selected text is highlighted on your display Note When you intend to select an entire single line of text in your script it is important to remember to extend your selection far enough to include the hidden end of line character which is the character that inserts a new line in your script Selecting A Line With the Keyboard Here s how to use the keyboard to select one or more whole lines in your script 1 Place the insertion point at the beginning of the line you want to select 2 Press Shift Down arrow The entire line including the end of line character is selected 3 To extend your selection to include additional whole lines of text repeat step 2 Once you have selected text within your script you can perform a variety of other editing operations on it including deleting the text placing it on the Clipboard either by cutting the text or copying it and pasting it Editing Programs 3 5 Deleting Text 3 6 When you delete material it is removed from your script without being placed on the Clipboard Deleting Selected Text Here s how to remove one or more
54. ation from what you entered You only have to change your entries in the Event Information dialog box if a script requires a change in a specific entry See GFK 1282 CIMPLICITY HMI Basic Control Engine Event Editor and BCEUI Operation Manual for information on configuring events Tracing Script Execution GFK 1305D Program Editor gives you two ways to trace script execution single step and procedure step both of which involve stepping through your script code line by line The distinction between the two is that the single step process traces into calls to user defined functions and subroutines whereas the procedure step process does not trace into these calls although it does execute them Stepping Through the Script Use one of these methods to trace the execution of your script with either the single step or procedure step method e Click the Step tool on the toolbar or press F8 Single Step e Press Shift F8 Procedure Step Program Editor places the instruction pointer on the sub main line of your script Note When you initiate execution of your script with any of these methods the script will first be compiled if necessary Therefore there may be a slight pause before execution actually begins If your script contains any compile errors it will not be executed To debug your script first correct any compile errors then initiate execution again To continue tracing the execution of your script line by line re
55. box is a displayed scrollable list from which users can select one item The currently selected item is highlighted on the list Adds a combo box to your dialog box A combo box consists of a text field with a displayed scrollable list beneath it Users can either select an item from the list or enter the name of the desired item in the text field The currently selected item is displayed in the text field If the item was selected from the scrolling list it is highlighted there as well Adds a drop list box to your dialog box A drop list box consists of a field that displays the currently selected item followed by a downward pointing arrow which users can click to temporarily display a scrolling list of items Once they select an item from the list the list disappears and the newly selected item is displayed in the field Adds a picture to your dialog box A picture is a field used to display a Windows bitmap or metafile Adds a picture button to your dialog box A picture button is a special type of push or command button on which a Windows bitmap or metafile appears 4 44 CIMPLICITY HMI Program Editor Operation Manual July 2001 GFK 1305D GFK 1305D Help Menu The Help menu commands are Menu Keyboard Command Shortcut Contents F1 Search for Help On About Dialog Editor Pick Tool Function Presents a list of major topics in the Help system By clicking a topic on the list you can display t
56. box is always set initially to the first control to appear in the dialog box template Second the order in which subsequent controls appear within the dialog box template determines the tabbing order That is pressing the Tab key will change the focus from the first control to the second one pressing the Tab key again will change the focus to the third control and so on Displaying the Custom Dialog Box To display a custom dialog box you can use either a Dialog function or a Dialog statement Using the Dialog Function You can use a Dialog function to determine how the user closed your custom dialog box For example the following statement will return a value when the user clicks an OK button or a Cancel button or takes another action response Dialog b The Dialog function returns any of the following values Value returned If 1 The user clicked the OK button 0 The user clicked the Cancel button gt 0 The user clicked a push button The returned number represents which button was clicked based on its order in the dialog box template 1 is the first push button 2 is the second push button and so on Using the Dialog Statement You can use the Dialog statement when you don t need to determine how the user closed your dialog box You ll still be able to retrieve other information from the dialog box record such as the value of a list box or other dialog box control An example of the correct use of the
57. ctions 2 To stop the test click the Run tool press F5 or double click the dialog box s close box if it has one 3 Make any necessary adjustments to the dialog box 4 Repeat steps 1 3 as many times as you need in order to get the dialog box working properly GFK 1305D Editing Custom Dialog Boxes 4 3 When testing a dialog box you can check for operational problems such as the following e Tabbing order When you press the Tab key does the focus move through the controls in a logical order Remember the focus skips over items that users cannot act upon including group boxes text controls and pictures When you paste controls into your dialog box Dialog Editor places their descriptions at the end of your dialog box template in the order in which you paste them in Therefore you can use a simple cut and paste technique to adjust the tabbing order First click the Run tool to end the test and then proceeding in the order in which you want the controls to receive the focus select each control cut it from the dialog box by pressing Ctrl X and immediately paste it back in again by pressing Ctrl V The controls will now appear in the desired order in your template and will receive the tabbing focus in that order e Option button grouping Are the option buttons grouped correctly Does selecting an unselected button in a group automatically deselect the previously selected button in that group To merge two groups
58. d portions of your script CIMPLICITY HMI Program Editor Operation Manual July 2001 GFK 1305D GFK 1305D Removing Breakpoints Breakpoints can be removed either manually or automatically To remove a single breakpoint manually Here s how to delete breakpoints manually one at a time 1 Place the insertion point on the line containing the breakpoint that you want to remove 2 Click the Toggle Breakpoint tool on the toolbar or press F9 The breakpoint is removed and the line no longer appears in contrasting type To remove all breakpoints manually Here s how to delete all breakpoints manually in a single operation e Select the Clear All Breakpoints command from the Debug menu Program Editor removes all breakpoints from your script Breakpoints are removed automatically under the following circumstances 1 As mentioned earlier when your script is compiled and executed breakpoints are removed from lines that don t contain code 2 When you exit from Program Editor all breakpoints are cleared Debugging Your Scripts 5 7 Using a Watch Variable As you debug your script you can use Program Editor s watch pane to monitor selected variables For each of the variables on this watch variable list Program Editor displays the name of the variable where it is defined its value if the variable is not in scope its value is shown as lt not in context gt and other key information such as its type and length if
59. d a number of date intervals to a date Subtract a number of date intervals from a date Return a portion of a date Assemble a date from date parts Convert a string to a date 1 7 Day Hour Minute Month Now Second Time Time functions Time Time statements Timer TimeSerial TimeValue Weekday Year DDE DDEExecute DDE Initiate DDEPoke DDERequest DDERequest DDESend DDETerminate DDETerminateAll DDETimeOut Error handling Erl Err function Err statement Error Error Error On Error Resume CIMPLICITY HMI Program Editor Operation Manual July 2001 Return the day component of a date value Return the hour part of a date value Return the minute part of a date value Return the month part of a date value Return the date and time Return the seconds part of a date value Return the current system time Set the system time Return the number of elapsed seconds since midnight Assemble a date time value from time components Convert a string to a date time value Return the day of the week of a date value Return the year part of a date value Execute a command in another application Initiate a DDE conversation with another application Set a value in another application Return a value from another application Establishe a DDE conversation then sets a value in another application Terminate a conversation with another application Terminate all conversations Set
60. dates the position of the mouse pointer in X and Y units This information disappears if you move the mouse pointer over an area of the screen where a control cannot be placed After you click the mouse button to add a control that control remains selected and the status bar displays the control s width and height in dialog units as well as its name and position as shown in the preceding illustration in which the push button is selected Note Dialog units represent increments of the font in which Dialog Editor creates dialog boxes namely 8 point Helvetica Each X unit represents an increment equal to 1 4 of that font and each Y unit represents an increment equal to 1 8 of that font Creating Controls Efficiently Creating dialog box controls in random order might seem like the fastest approach However the order in which you create controls has some important implications so a little advance planning can save you a lot of work in the long run Here are several points about creating controls that you should keep in mind e Tabbing order Users can select dialog box controls by tabbing as explained in the next subsection The order in which you create the controls is what determines the tabbing order That is as users tab through the dialog box the focus is changed from one control to the next in the order in which you created the controls regardless of the order in which you position the controls in the dialog box The closer
61. ditor differs from most word processing programs in that it allows you to place the insertion point anywhere within your script including in empty spaces Empty spaces are areas within the script that do not contain text such as a tabs expanded space or the area beyond the last character on a line Moving the Insertion Point with the Mouse This approach is especially fast if the area of the screen to which you want to move the insertion point is currently visible To move the insertion point with the mouse 1 Use the scroll bars at the right and bottom of the display to scroll the target area of the script into view if it 1s not already visible 2 Place the mouse pointer where you want to position the insertion point 3 1 3 Click the left mouse button The insertion point is repositioned Note When you scroll the display with the mouse the insertion point remains in its original position until you reposition it with a mouse click If you attempt to perform an editing operation when the insertion point is not in view Program Editor automatically scrolls the insertion point into view before performing the operation Moving the Insertion Point to a Specified Line This approach is especially fast if the area of the screen to which you want to move the insertion point is not currently visible but you know the number of the target line To move the insertion point to a specified line in your script 1 Press F4 Program Ed
62. e System functionality to enhance its already powerful monitoring capability in a full range of computer integrated manufacturing environments The Basic Control Engine option combines the power of the CIMPLICITY event handler with a Visual Basic compliant language allowing you to script and program applications and routines from the simple to the complex GFK 1305D 1 1 Basic Control Engine Components CIMPLICITY HMI Program Editor Operation Manual July 2001 The Basic Control Engine option consists of three main components e Event Editor e Program Editor e Basic Control Engine The Event Editor lets you define actions to take in response to events that occur in a process An event can be defined as a changing point alarm state or even a particular time of day One event may invoke multiple actions or one action may be invoked by many events The Program Editor provides a set of sophisticated development tools that let you create programs with a Visual Basic compliant programming language These programs can then be executed as actions in response to events The programming language has a rich set of nearly 500 standard Basic functions and also provides an object interface to CIMPLICITY points alarms and the Status Logger further enriching the language The Basic Control Engine monitors for events and executes the configured actions The Basic Control Engine is based on a multi threaded design that allows the system to invoke
63. e Dialog Editor makes it easy to generate these statements This chapter contains the following topics GFK 1305D Overview Using the Dialog Editor Creating a Custom Dialog Box Editing a Custom Dialog Box Editing an Existing Dialog Box Testing an Edited Dialog Box Pasting a Dialog Box Template into Your Script Exiting from Dialog Editor Using a Custom Dialog Box in Your Script Using a Dynamic Dialog Box in Your Script Menu Reference 4 1 Overview of Dialog Editor Sometimes your script will need to obtain information from the user In many cases you can obtain this information by using one of the Basic Control Engine s predefined dialog boxes in your script When you must go beyond the information gathering capabilities provided by predefined dialog boxes you can use Dialog Editor to create a custom dialog box for use in your script Dialog Editor is a tool that allows you to generate a dialog box template ina script simply by editing an on screen dialog box layout You can then incorporate the template that Dialog Editor generates into your script The balance of this section provides general information that you ll need in order to work with Dialog Editor including e Features that Dialog Editor supports e An introduction to Dialog Editor s application window e A list of keyboard shortcuts e How to use the Help system Then in the following sections you ll learn how to use Dialog Editor to create and edit c
64. e default value of the text box to 1 dozen response Dialog b Display the dialog box Select Case response Case 1 If b OptionGroupl1 0 Then produces fruits b ListBox1 Else produces vegetables b ListBox1 End If MsgBox Thank you for ordering amp b TextBoxl amp amp produce S amp Case 0 MsgBox Your order has been canceled End Select End Sub In the remainder of this section you ll learn how to make a dialog box dynamic by examining the workings of this sample script Making a Dialog Box Dynamic The first thing to notice about the preceding script which is a more complex variation of the dialog2 bcl script described earlier in this chapter is that an identifier named DialogControl has been added to the Begin Dialog statement As you will learn in the following subsection this parameter to the Begin Dialog statement tells the Basic Control Engine to pass control to a function procedure named DialogControl Using a Dialog Function Before the Basic Control Engine displays a custom dialog box by executing a Dialog statement or Dialog function it must first initialize the dialog box During this initialization process the Basic Control Engine checks to see whether you ve defined a dialog function as part of your dialog box template If so the Basic Control Engine will give control to your dialog function allowing your script to carry out certain actions such as hiding or disabling dialo
65. e the capture feature to grab an existing dialog box from another application and insert a copy of it into Dialog Editor 3 You can open a dialog box template file that has been saved on a disk Once you have the dialog box displayed in Dialog Editor s application window you can edit it using the methods described earlier in the chapter Pasting an Existing Dialog Box into Dialog Editor You can use Dialog Editor to modify the statements in your script that correspond to an entire dialog box or to one or more dialog box controls To paste an existing dialog box into Dialog Editor If you want to modify a dialog box template contained in your script here s how to select the template and paste it into Dialog Editor for editing 1 Copy the entire dialog box template from the Begin Dialog instruction to the End Dialog instruction from your script to the Clipboard 2 Open Dialog Editor 3 Press Ctrl V 4 When Dialog Editor asks whether you want to replace the existing dialog box click the Yes button Dialog Editor creates a new dialog box corresponding to the template contained on the Clipboard To paste one or more controls from an existing dialog box into Dialog Editor If you want to modify the statements in your script that correspond to one or more dialog box controls here s how to select the statements and paste them into Dialog Editor for editing 1 Copy the description of the control s from your script to the
66. ed b within a dialog box template named UserDialog Notice that the order of the statements within the script is as follows the dialog box template precedes the statement that creates the dialog record and the Dialog statement follows both of them Sub Main Dim ListBox1 Initialize list box array Define the dialog box template Begin Dialog UserDialog 163 94 Grocery Order Text 13 6 32 8 amp Quantity Textl TextBox 48 4 28 12 TextBoxl ListBox 12 28 68 32 ListBox1 ListBoxl OKButton 112 8 40 14 CancelButton 112 28 40 14 End Dialog Dim b As UserDialog Create the dialog record Dialog b Display the dialog box End Sub 4 34 CIMPLICITY HMI Program Editor Operation Manual July 2001 GFK 1305D GFK 1305D Putting Information into the Custom Dialog Box If you open and run the sample script shown in the preceding subsection you ll see a dialog box that resembles the following the dialog box you see may be different from the one shown below Grocery Order Quantity Cancel ib As you can see this custom dialog box isn t very useful For one thing the user doesn t see any items in the list box along the left side of the dialog box To put information into this dialog box you assign values to its controls by modifying the statements in your script that are responsible for displaying those controls to the user The following table lists the dialog box controls to which you can assign values and
67. en you use a resource editor you need to create a new resource type for metafiles with the value 256 Duplicating and Deleting Controls You can use Dialog Editor s duplicating feature if you need one or more copies of a particular control You can also use the delete features to delete a single control or clear an entire dialog box To duplicate a control Here s how to use Dialog Editor s duplicating feature which saves you the work of creating additional controls individually if you need one or more copies of a particular control 1 Select the control that you want to duplicate 2 Press Ctrl D A duplicate copy of the selected control appears in your dialog box 3 Repeat step 2 as many times as necessary to create the desired number of duplicate controls Duplicating is a particularly efficient approach if you need to create a group of controls such as a series of option buttons or check boxes Simply create the first control in the group and then while the newly created control remains selected repeatedly press Ctrl D until you have created the necessary number of copies 4 26 CIMPLICITY HMI Program Editor Operation Manual July 2001 GFK 1305D To delete a single control If you want to remove controls from your dialog box selectively here s how to delete them one at a time 1 Select the control you want to delete 2 Press Delete The selected control is removed from your dialog box To delete all the cont
68. enu When you select the Tools menu the following drop down list is displayed Points Alarms Log Status Dynamic The Tools menu options are Points Displays a submenu that lets you browse for points edit a point and create a new point You can also use this menu item to include Setpoints Get Points and create local variables in the program Alarms Displays a submenu that lets you generate or update alarms in the program Log Status Displays a dialog box that lets you generate messages for the Status Log Dynamic Toggles Dynamic Configuration of points alarm etc The View Menu When you select the View menu the following drop down list is displayed Toolbars v status Bar The View menu options are Toolbars Displays the list of available toolbars You can toggle the display of each toolbar Status Bar Toggles the display of the Status Bar at the bottom of program windows CIMPLICITY HMI Program Editor Operation Manual July 2001 GFK 1305D GFK 1305D The Window Menu When you select the Window menu the following drop down list is displayed New YWfindow Cascade Tile Horizontally Tile Vertically Arrange Icons x 1 Basicl The Window menu options are New Window Opens a new window Cascade Arranges the windows so that they overlap Tile Horizontally Tiles the windows horizontally Tile Vertically Tiles the windows vertically Arrange Icons Arranges the program icons in the Progr
69. ere s how to open any dialog box template file that has been saved on a disk so you can edit the template in Dialog Editor 1 Choose Open from the File menu The Open Dialog File dialog box appears 2 Select the file containing the dialog box template that you want to edit and click the OK button Dialog Editor creates a dialog box from the statements in the template and displays it in the application window Note If there are any errors in the statements that describe the dialog box the Dialog Translation Errors dialog box will appear when you attempt to load the file into Dialog Editor This dialog box shows the lines of code containing the errors and provides a brief description of the nature of each error 4 30 CIMPLICITY HMI Program Editor Operation Manual July 2001 GFK 1305D Testing an Edited Dialog Box Dialog Editor lets you run your edited dialog box for testing purposes When you click the Test tool your dialog box comes alive which gives you an opportunity to make sure it functions properly and fix any problems before you incorporate the dialog box template into your script Before you run your dialog box take a moment to look it over for basic problems such as the following e Does the dialog box contain a command button that is a default OK or Cancel button a push button or a picture button e Does the dialog box contain all the necessary push buttons e Does the dialog box contain a Help button if one is
70. es and functions Promoting code re use will simplify maintenance and development To use a library simply load the script into a window in the editor the code is now available for all other scripts in the application You can set breakpoints in the library and when another script reaches that execution point it will pause in its own window at the line of code Multiple Threads of Execution You can run many scripts at the same time from within the development environment Each window is a thread of execution and you may start and stop windows as needed Dialog Editor A integrated dialog editor is provided to allow you to create custom User Interface applications On Line Help A full API reference for the Basic Control Engine language is available on line by pressing the F1 key within the application To start the Program Editor you can double click on the Program Editor icon in the CIMPLICITY Common cabinet or in your project group Program Editor The Program Editor window is displayed About The Program Editor 2 3 Program Editor Window Components 2 4 When you are using the Program Editor the window looks similar to this CIRKAPLICITY Program Editor onchange bcl ud Tools Taiga Window Help onchange Hain a LEVEL SOAP Ea Sub Maing Dim X as new Point aS InputBox Enter a point id x Id a x OnChange Trace str x TimesStamp U T amp Ualue S Se ED 3 1 96 4 59 32 PM 500 l U U
71. essage and some buttons Display a dialog containing a message and some buttons Display a dialog requesting a file to open Display a dialog requesting the name of a new file Display a dialog allowing selection of an item from an array GFK 1305D GFK 1305D Printing Print Spc Tab Procedures Declare Exit Function Exit Sub Function End Function Sub End Sub String operators amp Like Strings Format Format InStr LCase LCase Left Left Len LSet LTrim LTrim Mid Mid functions Mid Mid statements Option Compare Option CStrings Right Right RSet RTrim RTrim Space Space StrComp String String Trim Trim UCase UCase Introduction Print data to the screen Print a number of spaces within a Print statement Used with Print to print spaces up to a column position An external routine or a forward reference Exit a function Exit a subroutine Create a user defined function Create a user defined subroutine Concatenate two strings Compare a string against a pattern Return a string formatted to a given specification Return the position of one string within another Convert a string to lower case Return the left portion of a string Return the length of a string or the size of a data item Left align a string or user defined type within another Remove leading spaces from a string Return a substring from a string Replace one part of a string with anot
72. et on lines in your script that contain code including lines in functions and subroutines Although you can set a breakpoint anywhere within a script prior to execution when you compile and run the script invalid breakpoints that is breakpoints on lines that don t contain code are automatically removed While you are debugging your script Program Editor will beep if you try to set a breakpoint on a line that does not contain code Start Debugging at a Select Point Here s how to begin the debugging process at a selected point in your script 1 Place the insertion point in the line where you want to start debugging 2 To set a breakpoint on that line click the Toggle Breakpoint tool on the toolbar or press F9 The line on which you set the breakpoint now appears in contrasting type 3 Click the Start tool on the toolbar or press F5 Program Editor runs your script at full speed from the beginning and then pauses prior to executing the line containing the breakpoint It places the instruction pointer on that line to designate it as the line that will be executed next when you either proceed with debugging or resume running the script If you want to continue debugging at another line in your script you can use the Set Next Statement command in the Debug menu to move the instruction pointer to the desired line provided the line is within the same subroutine GFK 1305D Debugging Your Scripts 5 5 5 6 Start Debugging at a Line Ou
73. expected for parameter Array type unexpected for parameter Integer expression expected for an array index Integer expression expected String expression expected Left of must be an object structure or dialog Invalid string operator Can t apply operator to array type Operator type mismatch placeholder is not a variable B 1 23 24 25 26 27 28 29 30 31 32 33 34 35 37 39 40 41 42 43 44 46 47 48 49 50 51 52 55 56 57 58 59 60 61 62 63 placeholder is not a array variable or a function Unknown placeholder placeholder Out of memory placeholder Too many parameters encountered placeholder Missing parameter s placeholder Type mismatch in parameter placeholder Missing label placeholder Too many nested statements Encountered new line in string Overflow in decimal value Overflow in hex value Overflow in octal value Expression is not constant No type characters allowed on parameters with explicit type Can t pass an array by value placeholder is already declared as a parameter Variable name used as label name Duplicate label Not inside a function Not inside a sub Can t assign to function Identifier is already a variable Unknown type Variable is not an array type Can t redimension an array to a different type Identifier is not a string array variable 0 expected Integer expression expected for file number placeholder is not a method of the object placeholder is not a
74. f an Item Dialog boxes and controls can be resized either by directly manipulating them with the mouse or by using the Information dialog box Certain controls can also be resized automatically to fit the text displayed on them To resize an item with the mouse Here s how to change the size of a selected dialog box or control by dragging its borders or corners with the mouse 1 With the Pick tool active select the dialog box or control that you want to resize 2 Place the mouse pointer over a border or corner of the item 3 Depress the mouse button and drag the border or corner until the item reaches the desired size To resize an item with the Information dialog box Here s how to change the size of a selected dialog box or control by changing its Width and or Height settings in the Information dialog box 1 Display the Information dialog box for the dialog box or control that you want to resize 2 Change the Width and Height settings in the Size group box 3 Click the OK button or press Enter The dialog box or control is resized to the dimensions you specified To resize selected controls automatically Here s how to adjust the borders of certain controls automatically to fit the text displayed on them 1 With the Pick tool active select the option button text control push button check box or text box that you want to resize 2 Press F2 The borders of the control will expand or contract to fit the text
75. focus in a dynamic dialog Set focus to a control in a dynamic dialog Set the content of a list box or combo box in a dynamic dialog Set the content of a list box or combo box in a dynamic dialog Set the picture of a control in a dynamic dialog Set the content of a control in a dynamic dialog Return the content of a control in a dynamic dialog Return the value of a control in a dynamic dialog Set the value of a control in a dynamic dialog Determine if a control is visible in a dynamic dialog Set the visibility of a control in a dynamic dialog Define a drop list box in a dialog template Define a group box in a dialog template Add a list box to a dialog template Add an OK button to a dialog template Add an option button to a dialog template Add an option group to a dialog template Add a picture control to a dialog template Add a picture button to a dialog template Add a push button to a dialog template Add a text control to a dialog template Add a text box to a dialog template GFK 1305D Variables and constants Const DefBool DefCur DefDate DefDbl DefInt DefLng DefOb j DefSng DefStr DefVar Dim Global Let Private Public Set Type Variants IsEmpty IsError IsMissing IsNull IsObject VarType GFK 1305D Assignment Define a constant Set the default data type to Boolean Set the default data type to Currency Set the default data type to Date Set the default data type to Double Set the defau
76. g box 4 Exit from Dialog Editor and return to Program Editor Program Editor automatically places the new dialog box template generated by Dialog Editor in your script at the location of the insertion point Editing An Existing Dialog Box Here s how to invoke Dialog Editor and use it to modify a dialog box template contained in your script 1 Select the code for the entire dialog box template 2 From the Edit menu choose the Edit Dialog command Program Editor s application window is temporarily disabled and Dialog Editor appears displaying in its application window a dialog box created from the code you selected 3 Use Dialog Editor to modify your dialog box 4 Exit from Dialog Editor and return to Program Editor Program Editor automatically replaces the dialog box template you originally selected with the revised template generated by Dialog Editor Refer to Chapter 4 for a detailed discussion of how to use Dialog Editor to create and edit dialog box templates GFK 1305D Editing Programs 3 13 Editing Custom Dialog Boxes About Editing Dialog Boxes You can use a custom dialog box to display information to a user while providing an opportunity for the user to respond The Dialog Editor 19 a tool that enables you to create and modify custom dialog boxes for use in your scripts Although the statements used to display a custom dialog box and respond to the choices made by a user of the dialog box may seem complicated th
77. g box controls After completing its initialization process the Basic Control Engine displays your custom dialog box When the user selects an item in a list box clears a check box or carries out certain other actions within the dialog box the Basic Control Engine will again call your dialog function Editing Custom Dialog Boxes 4 39 Responding to User Actions The Basic Control Engine dialog function can respond to six types of user actions Action Description 1 This action is sent immediately before the dialog box is shown for the first time 2 This action is sent when A button is clicked such as OK Cancel or a push button A check box s state has been modified An option button is selected In this case ControlName contains the name of the option button that was clicked and Supp Value contains the index of the option button within the option button group 0 is the first option button 1 is the second and so on The current selection is changed in a list box drop list box or combo box In this case ControlName contains the name of the list box combo box or drop list box and SuppValue contains the index of the new item 0 is the first item 1 is the second and so on 3 This action is sent when the content of a text box or combo box has been changed and that control loses focus 4 This action is sent when a control gains the focus 5 This action is sent continuously when the dialog box is idle The user
78. grid setting For example if the grid s X setting is 4 and its Y setting is 6 you ll be able to move the control horizontally only in increments of 4 X units and vertically only in increments of 6 Y units This feature is handy if you re trying to align controls in your dialog box If you want to move controls in smaller or larger increments press Ctrl G to display the Grid dialog box and adjust the X and Y settings To reposition an item with the arrow keys Here s how to move a selected dialog box or control by pressing the arrow keys 1 Select the dialog box or control that you want to move 2 Press an arrow key once to move the item by 1 X or Y unit in the desired direction or depress an arrow key to nudge the item steadily along in the desired direction Note When you reposition an item with the arrow keys a faint partial afterimage of the item may remain visible in the item s original position These afterimages are rare and will disappear once you test your dialog box Editing Custom Dialog Boxes 4 19 To reposition a dialog box with the Dialog Box Information dialog box Here s how to move a selected dialog box by changing its coordinates in the Dialog Box Information dialog box 1 Display the Dialog Box Information dialog box 2 Change the X and Y coordinates in the Position group box or leave the X and or Y coordinates blank 3 Click the OK button or press Enter If you specified X and Y coordinates the
79. he available Help information about that topic Displays a dialog box that allows users to search for Help topics containing specific keywords Displays the About Dialog Editor dialog box which indicates application name version number copyright statement and icon as well as additional information such as amount of available memory and disk space The Pick toolbar tool looks like this Toolbar Tool Function Lets you select move and resize items and control the insertion point Editing Custom Dialog Boxes 4 45 Debugging Your Scripts About the Debugger This section presents some general information that will help you work most effectively with Program Editor s debugging capabilities and then explains how to trace the execution of your script how to set and remove breakpoints and how to add watch variables and modify their value Using the Debugger While debugging you are actually executing the code in your script line by line Therefore to prevent any modifications to your script while it is being run the edit pane is read only during the debugging process You are free to move the insertion point throughout the script select text and copy it to the Clipboard as necessary set breakpoints and add and remove watch variables but you cannot make any changes to the script until you stop running it To let you follow and control the debugging process Program Editor displays an instruction pointer on the line of
80. hen publicly 2 Enter the new value for your variable in the Value field 3 Click the OK button The new value of your variable appears on the watch variable list When changing the value of a variable Program Editor converts the new value to be of the same type as the variable being changed For example if you change the value of an Integer variable to 1 7 a conversion between a floating point number and an Integer is performed assigning the value 2 to the Integer variable CIMPLICITY HMI Program Editor Operation Manual July 2001 GFK 1305D GFK 1305D When modifying a Variant variable Program Editor needs to determine both the type and value of the data Program Editor uses the following logic in performing this assignment in this order If the new value is Null Empty True False number date Anything else Then The Variant variable is assigned Null VarType 1 The Variant variable is assigned Empty VarType 0 The Variant variable is assigned True VarType 11 The Variant variable is assigned False VarType 11 The Variant variable is assigned the value of number The type of the variant is the smallest data type that fully represents that number You can force the data type of the variable using a type declarator letter following number such as Z amp or The Variant variable is assigned the value of the new date VarType 7 The Variant variable is assigned a String VarTy
81. her Change the default comparison between text and binary Allow interpretation of C style escape sequences in strings Return the right portion of a string Right align a string within another Remove trailing spaces from a string Return a string os spaces Compare two strings Return a string consisting of a repeated character Trim leading and trailing spaces from a string Return the upper case of a string 1 13 User dialogs Begin Dialog CancelButton CheckBox ComboBox Dialog function Dialog statement DlgControlld DlgEnable function DlgEnable statement DlgFocus function DlgFocus statement DigListBoxArray function DigListBoxArray statement DlgSetPicture DlgText statement DigText function DlgValue function DlgValue statement DlgVisible function DlgVisible statement DropListBox GroupBox ListBox OKButton OptionButton OptionGroup Picture PictureButton PushButton Text TextBox CIMPLICITY HMI Program Editor Operation Manual July 2001 Begin definition of a dialog template Define a Cancel button within a dialog template Define a combo box in a dialog template Define a combo box in a dialog template Invoke a user dialog returning which button was selected Invoke a user dialog Return the id of a control in a dynamic dialog Determine if a control is enabled in a dynamic dialog Enable or disables a control in a dynamic dialog Return the control with the
82. ickWatch toolbar button or select QuickWatch from the right mouse button popup menu and you are on your way The inspector utilizes a tree structure to help you navigate through your objects and structures Trace Window You can resize the trace window in the lower part of the document window as needed by dragging the separator The trace window receives the results of all Trace commands executed by your program Controls are provided to toggle tracing on off and to clear the trace window The trace window is useful for diagnostics and debugging Breakpoints You can set breakpoints in any script you are viewing When an executing script reaches the line execution will pause and you may inspect variables or continue execution Up to 255 breakpoints are supported per script Step In Step Over Step In and Step Over provide tools to single step through your script s execution Step Over steps over the current line while Step In will step into the current any function or procedure within the line When stepping into another script the contents of the debugger window are replaced with the called script You can view the Call Stack to see the stack of function calls which brought you to the current point of execution CIMPLICITY HMI Program Editor Operation Manual July 2001 GFK 1305D Getting Started GFK 1305D InterScript Calls As applications grow in size you may find it useful to have libraries of commonly used Basic procedur
83. ied text quickly anywhere within your script 1 Move the insertion point to where you want to start your search To start at the beginning of your script press Ctrl Home 2 Press Ctrl F Program Editor displays the Find dialog box Cancel Match Case 3 Inthe Find What field specify the text you want to find 4 Select the Match Case check box if you want the search to be case sensitive Otherwise the search will be case insensitive 5 Click the Find Next button or press Enter The Find dialog box remains displayed and Program Editor either highlights the first instance of the specified text or indicates that it cannot be found 6 If the specified text has been found repeat step 5 to search for the next instance of it Note If the Find dialog box blocks your view of an instance of the specified text you can move the dialog box out of your way and continue with your search You can also click the Cancel button which removes the Find dialog box while maintaining the established search criteria and then press F3 to find successive occurrences of the specified text If you press F3 when you have not previously specified text for which you want to search Program Editor displays the Find dialog box so you can specify the desired text 3 10 CIMPLICITY HMI Program Editor Operation Manual July 2001 GFK 1305D GFK 1305D Replacing Text in Your Script Here s how you can automatically replace either all insta
84. inted Displays the list of most recently accessed files Compiles the active document Creates a new document for the Program Editor Exits the Program Editor 2 5 2 6 The Edit Menu When you select the Edit menu the following drop down list is displayed Undo Cr Z Ctrl tx Ctrl C Ctrl tY Delete Eind Ctrl F Find Next F3 Replace Goto Line Ctrl G Insert Dialog Edit Dialog Font Ctrl D Options The Edit menu functions are Undo Undoes the last action Cut Cuts the selection and puts it on the Clipboard Copy Copies the selection and puts it on the Clipboard Paste Inserts Clipboard contents Clear Deletes the selection Find Finds user identified text in the document Find Next Finds next occurrence of user identified text in the document Replace Replaces user identified text with new text Goto Line Goes to the selected line Insert Dialog Inserts a dialog box Edit Dialog Edits an inserted dialog box Font Selects a font Options Sets string and stack space CIMPLICITY HMI Program Editor Operation Manual July 2001 GFK 1305D GFK 1305D The Run Menu When you select the Run menu the following drop down list is displayed Start F5 Break End The Run menu options are Start Run the program Break Break executing program End End the running or paused program The Debug Menu When you select the Debug menu the following drop down list is displayed Add Y
85. it is a string The values of the variables on the watch list are updated each time you enter break mode Adding A Watch Variable Here s how to add a variable to Program Editor s watch variable list 1 Click the Add Watch tool on the toolbar or press Shift F9 Program Editor displays the Add Watch dialog box Add Yatch Variable Procedure Main Script search C 2 Inthe Variable field enter the name of the variable you want to add to the watch variable list 3 Inthe Procedure field enter the procedure name 4 Inthe Script field enter the script name You can only watch variables of fundamental data types such as Integer Long Variant and so on you cannot watch complex variables such as structures or arrays You can however watch individual elements of arrays or structure members using the following syntax variable index member index Where variable is the name of the structure or array variable index is a literal number and member is the name of a structure member 5 8 CIMPLICITY HMI Program Editor Operation Manual July 2001 GFK 1305D For example the following are valid watch expressions Watch Variable Description a 1 Element 1 of array a person age Member age of structure person company 10 23 person age Member age of structure person that is at element 10 23 within the array of structures called company Note If you are executing the script you can disp
86. it on the Clipboard Inserts the contents of the Clipboard Cuts the selection Opens the Find dialog box Finds the next occurrence of the string in the Find dialog box Opens the Go To Line dialog box Opens the Font dialog box Opens the Add Watch dialog box Steps to the next line in the script Steps to the next line in the script If itis a procedure call the next line is the first line in the procedure Toggles a breakpoint for the debugger Starts running a script GFK 1305D Setting String and Stack Space The Basic Control Engine has two regions of memory String Space and Stack Space e String Space holds all string variables arrays and public data Default String Space size is 1 MB 1024 KB e Stack Space holds all local variables and intermediate values Default Stack Space size is 4 KB You can change the size of either of these spaces The changes apply to all Basic Control Engine scripts that run as executables within the Program Editor or from the Event Manager To change String Space and Stack Space sizes 1 Select Options from the Edit menu 2 The Options dialog opens Stack space 4 Kb Cancel Enter the number of kilobytes of String Space in String Space Enter the number of kilobytes of Stack Space in Stack Space Select OK S N e When the message You must stop and restart BASIC for the changes to take effect appears select OK Also note the following e You can substantia
87. itor you can select either a portion of one line or a series of whole lines but you cannot select a portion of one line plus one or more whole lines When you are selecting multiple lines and start or end your selection partway through a line Program Editor automatically extends the selection to include the entire starting and ending lines Selecting Text With the Mouse To select the text in your script place the mouse pointer where you want your selection to begin then do one of the following e While pressing the left mouse button drag the mouse until you reach the end of your selection and release the mouse button e While pressing Shift place the mouse pointer where you want your selection to end and click the left mouse button The selected text is highlighted on your display as shown in this example Basic Sub Maing Hotepad Selectall StartLine Notepad SeliInfo 1 EndLine Notepad SellInfo For 1 StartLine to EndLine Notepad Movelo 6 1 6 Hotepad Insert amp i amp yj Hext 1 End Sub L LL T Another way to select one or more whole lines with the mouse is to start by placing the mouse pointer in the left margin beside the first line you want to select The pointer becomes a reverse arrow which points toward the line of text Click the left mouse button to select a single line press the left mouse button and drag up or down to select multiple lines 3 4 CIMPLICITY HMI Program Editor Oper
88. itor displays the Goto Line dialog box Line Number 2 Enter the number of the line in your script to which you want to move the insertion point 3 Click the OK button or press Enter The insertion point is positioned at the start of the line you specified If that line was not already displayed Program Editor scrolls it into view Note The insertion point cannot be moved so far below the end of a script as to scroll the script entirely off the display When the last line of your script becomes the first line on your screen the script will stop scrolling and you will be unable to move the insertion point below the bottom of that screen CIMPLICITY HMI Program Editor Operation Manual July 2001 GFK 1305D Inserting Text GFK 1305D In Program Editor inserting text and other characters such as tabs and line breaks works about the same way as it does in a word processing program you position the insertion point at the desired location in the script and start typing However as noted in the preceding subsection Program Editor lets you position the insertion point in empty spaces which means that you can also insert text into empty spaces a feature that comes in handy when you want to insert a comment in the space beyond the end of a line in your script Adding comments to your script is discussed later in this section When you insert characters beyond the end of a line the space between the insertion point and the
89. last character on the line is backfilled with tab characters Another way in which Program Editor differs from word processing programs 1s that in Program Editor text does not wrap If you keep entering text on a given line eventually you will reach a point at which you can enter no more text on that line Therefore you control the line breaks by pressing Enter when you want to insert a new line in your script The effect of pressing Enter depends on where the insertion point is located at the time e If you press Enter with the insertion point at or beyond the end of a line a new line 1s inserted after the current line e If you press Enter with the insertion point at the start of a line a new line is inserted before the current line e If you press Enter with the insertion point within a line the current line is broken into two lines at that location If you press Tab a tab character is inserted at the location of the insertion point which causes text after the tab to be moved to the next tab position If you insert new text within a tab s expanded space the text that originally appeared on that line is moved to the next tab position each time the new text that you are entering reaches the start of another tab position Editing Programs 3 3 Selecting Text You can use either the mouse or the keyboard to select text and other characters in your script Regardless of which method you use you should be aware that in Program Ed
90. lay the names of all the variables that are in scope or defined within the current function or subroutine on the drop down Variable Name list and select the variable you want from that list 5 Click the OK button or press Enter If this is the first variable you are placing on the watch variable list the watch pane opens far enough to display that variable If the watch pane was already open it expands far enough to display the variable you just added Note Although you can add as many watch variables to the list as you want the watch pane only expands until it fills half of Program Editor s application window If your list of watch variables becomes longer than that you can use the watch pane s scroll bars to bring hidden portions of the list into view The list of watch variables is maintained between script executions Selecting A Watch Variable In order to delete a variable from Program Editor s watch variable list or modify the value of a variable on the list you must first select the desired variable Use one of these methods to select a variable on the list e Place the mouse pointer on the variable you want to select and click the left mouse button e If one of the variables on the watch list is already selected use the arrow keys to move the selection highlight to the desired variable e If the insertion point is in the edit pane press F6 to highlight the most recently selected variable on the watch list and then
91. lect Case action Case 1 DligListBoxArray ListBox1 fruits Fill list box with items before dialog box is visible DlgValue ListBox1 0 Set default value to first item in list box Case 2 Fill the list box with names of fruits or vegetables when the user selects an option button If ctrl OptionButtonl1 Then DlgListBoxArray ListBox1 fruits DlgValue ListBox1 0 ElseIf ctrl OptionButton2 Then DlgListBoxArray ListBox1 vegetables DlgValue ListBox1 0 End If End Select End Function Sub Main Dim ListBox1 Initialize array for use by ListBox statement in template Dim Produce Assign values to elements in the Fruits and Vegetables arrays Fruits 0 Apples Fruits 1 Oranges Fruits 2 Pears Vegetables 0 Carrots Vegetables 1 Peas Vegetables 2 Lettuce Define the dialog box template Begin Dialog UserDialog 163 94 Grocery Order DialogControl Text 13 6 32 8 amp Quantity Textl First control in 4 38 CIMPLICITY HMI Program Editor Operation Manual July 2001 GFK 1305D GFK 1305D template gets the focus TextBox 48 4 28 12 TextBoxl ListBox 12 28 68 32 ListBox1S ListBoxl OptionGroup OptionGroup1l OptionButton 12 68 48 8 amp Fruit OptionButtonl OptionButton 12 80 48 8 amp Vegetables OptionButton2 OKButton 112 8 40 14 CancelButton 112 28 40 14 End Dialog Dim b As UserDialog Create the dialog record b TextBoxl 12 Set th
92. lected button in that group Editing Custom Dialog Boxes 4 7 4 8 Check box Check box is a box that users can check or clear to indicate their preference regarding the alternative specified on the check box label Group box Group box is a rectangular design element used to enclose a group of related controls You can use the optional group box label to display a title for the controls in the box Note Group boxes text controls and pictures are passive elements in a dialog box inasmuch as they are used purely for decorative or informative purposes Users cannot act upon these controls and when they tab through the dialog box the focus skips over these controls Text Text is a field containing text that you want to display for the users information The text in this field wraps and the field can contain a maximum of 255 characters Text controls can either display stand alone text or be used as labels for text boxes list boxes combo boxes drop list boxes pictures and picture buttons You can choose the font in which the text appears Note Group boxes text controls and pictures are passive elements in a dialog box inasmuch as they are used purely for decorative or informative purposes Users cannot act upon these controls and when they tab through the dialog box the focus skips over these controls Text box Text box is a field into which users can enter text potentially as much as 32K By default this
93. lly reduce your stack usage by explicity defining the types of variables in other words don t use variants e Recursive routines have an impact on Stack Space e If you use arrays or arrays of User Defined Types allocation occurs in the String Space which may alleviate some stack usage GFK 1305D About The Program Editor 2 13 Editing Programs About Editing Programs Although in some respects editing code with the Program Editor is like editing regular text with a word processing program the Program Editor also has certain capabilities specifically designed to help you edit your code This section describes how to move around within your script select and edit text add comments to your script break long statements across multiple lines search for and replace selected text and perform a syntax check of your script The section ends with a brief discussion of editing dialog box templates which is explained in much more detail in Chapter 4 Navigating within a Script GFK 1305D The lists of keyboard shortcuts in the preceding section contain a group of navigating shortcuts which you can use to move the insertion point around within your script When you move the insertion point with a keyboard shortcut Program Editor scrolls the new location of the insertion point into view if it is not already displayed You can also reposition the insertion point with the mouse and the Goto Line command as explained below Program E
94. looks like a butterfly net 4 Place the mouse pointer over the dialog box that you want to capture If the mouse pointer is over a standard Windows dialog box that contains some standard Windows controls a tiny dialog box appears in front of the mouse pointer s butterfly net to indicate that the pointer has found controls that can be captured If the mouse pointer is not over a standard Windows dialog box that contains standard Windows controls the butterfly net remains unchanged to indicate that the mouse pointer has not found controls that can be captured Mouse pointer positioned over an area of the screen that does not contain standard Windows controls Mouse pointer positioned over a standard Windows dialog box that contains some standard Windows controls 5 Click the mouse button Dialog Editor s application window moves in front of all other open application windows and now displays the standard Windows controls from the target dialog box GFK 1305D Editing Custom Dialog Boxes 4 29 Note Dialog Editor only supports standard Windows controls and standard Windows dialog boxes Therefore if the target dialog box contains both standard Windows controls and custom controls only the standard Windows controls will appear in Dialog Editor s application window If the target dialog box is not a standard Windows dialog box you will be unable to capture the dialog box or any of its controls Opening a Dialog Box Template File H
95. ls to the current dialog box If the Clipboard contains the script template for an entire dialog box then Dialog Editor creates a new dialog box from the statements in the template Removes the selected dialog box or control from Dialog Editor s application window and places it on the Clipboard Undoes the preceding operation Removes the selected dialog box or control from Dialog Editor s application window without placing it on the Clipboard Displays Help for the currently active window Runs the dialog box for testing purposes Sizes certain controls to fit the text they contain Toggles the Help pointer Editing Custom Dialog Boxes 4 5 4 6 Using the Help System Dialog Editor provides several ways to obtain on line help You can display Help for the window or dialog box that is currently active or you can search for a specific topic Display Help for the currently active window To display Help for the currently active window e Press F1 If Dialog Editor s application window was active the Help system contents appear If a dialog box was active Help for that dialog box appears Searching for a Topic To pinpoint a specific topic in the Help system 1 From the Help menu choose the Search for Help on command A scrollable list of Help topics appears 2 Select the desired topic from the list The topic you selected is displayed in a second scrollable list together with closely related Help topics if any
96. lt data type to Integer Set the default data type to Long Set the default data type to Object Set the default data type to Single Set the default data type to String Set the default data type to Variant Declare a local variable Declare variables for sharing between scripts Assign a value to a variable Declare variables accessible to all routines in a script Declare variables accessible to all routines in all scripts Assign an object variable Declare a user defined data type Determine if a variant has been initialized Determine if a variant contains a user defined error Determine if an optional parameter was specified Determine if a variant contains valid data Determine if an expression contains an object Return the type of data stored in a variant About The Program Editor Functional Overview GFK 1305D The Program Editor utilizes an embedded Basic language that is syntactically compatible with Microsoft s Visual Basic for Applications This language provides the rich Basic command set in addition to CIMPLICITY software specific extensions Both the command set and extensions are documented in the remainder of this document The Program Editor provides an integrated development and debug environment including the following features e Wizards e Watch Window e Quickwatch Object Inspector e Trace Window e Breakpoints e Step In Step Over Stop e Set Variable to value e Interscript calls e M
97. n Dialog Editor 4 20 OK buttons in Dialog Editor 4 7 option buttons in Dialog Editor 4 7 picture buttons in Dialog Editor 4 9 picture controls in Dialog Editor 4 9 positioning with grid in Dialog Editor 4 11 4 12 push buttons in Dialog Editor 4 7 resizing in Dialog Editor 4 21 selecting in Dialog Editor 4 14 text boxes in Dialog Editor 4 8 4 32 text controls in Dialog Editor 4 8 dialog controls in Dialog Editor See also dialog boxes in Dialog Editor dialog controls Dialog Editor user dialogs accelerator keys assigning to 4 22 4 23 testing 4 32 adding to dialog box 4 94 10 attributes of adjusting with Information dialog box 4 17 4 18 Cancel buttons 4 7 check boxes 4 8 combo boxes 4 8 creating efficiently 4 12 4 13 deleting all controls 4 27 one control 4 27 drop list boxes 4 9 duplicating 4 26 group boxes 4 8 hidden 4 20 Information dialog box for displaying 4 16 labels of changing 4 22 list boxes 4 8 moving with arrow keys 4 19 with Information dialog box 4 20 with mouse 4 19 OK buttons 4 7 option buttons 4 7 grouping 4 13 4 32 pasting controls into Dialog Editor 4 28 picture buttons 4 9 See also dialog controls in Dialog Editor specifying pictures picture controls 4 9 See also dialog controls in Dialog Editor specifying pictures positioning with grid 4 11 4 12 push buttons 4 7 resizing 4 21 automatically 4 21 with Information dialog box 4 21 with mouse 4 21 selecting 4 14 specifying
98. nces or selected instances of specified text 1 Move the insertion point to where you want to start the replacement operation To start at the beginning of your script press Ctrl Home 2 Choose the Replace command from the Search menu Program Editor displays the Replace dialog box Find What Find Next Replace With Replace Replace All Cancel Match Case 3 Inthe Find What field specify the text you want to replace 4 Inthe Replace With field specify the replacement text 5 Select the Match Case check box if you want the replacement operation to be case sensitive Otherwise it will be case insensitive 6 To replace all instances of the specified text click the Replace All button Program Editor either replaces the specified text throughout your script and indicates the number of occurrences it has changed or it indicates that the specified text cannot be found 7 To replace selected instances of the specified text click the Find Next button Program Editor either highlights the first instance of the specified text or indicates that it cannot be found 8 If the specified text has been found either click the Replace button to replace that instance of it or click the Find Next button to highlight the next instance if any Each time you click the Replace button Program Editor replaces that instance of the specified text and automatically highlights the next instance Editing Programs 3 1 Checking
99. nd the Y vertical axis intersect in the upper left corner of the display the 0 O coordinates The position of the dialog box you are creating can be expressed in terms of X units with respect to the left border of the parent window and in terms of Y units with respect to the top border As explained in the preceding section the portion of your dialog box below the title bar can also be thought of as a grid with the X and Y axes intersecting in the upper left corner of this area The position of controls within the dialog box can be expressed in terms of X units with respect to the left border of this area and in terms of Y units with respect to the top border When you select a dialog box or control the status bar displays its position in X and Y units as well as its width and height in dialog units Each time you move or resize an item the corresponding information on the status bar is updated You can use this information to position and size items more precisely Dialog Editor provides several ways to reposition dialog boxes and controls To reposition an item with the mouse Here s how to move a dialog box or control by dragging it with the mouse 1 With the Pick tool active place the mouse pointer on an empty area of the dialog box or on a control 2 Depress the mouse button and drag the dialog box or control to the desired location Note The increments by which you can move a control with the mouse are governed by the
100. needed e Are the controls aligned and sized properly e Ifthere is a text control is its font set properly e Are the close box and title bar displayed or hidden as you intended e Are the control labels and dialog box title spelled and capitalized correctly e Do all the controls fit within the borders of the dialog box e Could you improve the design of the dialog box by adding one or more group boxes to set off groups of related controls e Could you clarify the purpose of any unlabeled control such as a text box list box combo box drop list box picture or picture button by adding a text control to serve as a de facto label for it e Have you made all the necessary accelerator key assignments After you ve fixed any elementary problems you re ready to run your dialog box so you can check for problems that don t become apparent until a dialog box is activated Testing your dialog box is an iterative process that involves running the dialog box to see how well it works identifying problems stopping the test and fixing those problems then running the dialog box again to make sure the problems are fixed and to identify any additional problems and so forth until the dialog box functions the way you intend To test your dialog box Here s how to test your dialog box and fine tune its performance 1 Click the Run tool on the toolbar or press F5 The dialog box becomes operational and you can check how it fun
101. nformation from Basic Control Engine Basic Capability Basic Eoln Basic FreeMemory Basic HomeDir Basic OS Basic PathSeparator Basic Version 1 10 CIMPLICITY HMI Program Editor Operation Manual July 2001 Return capabilities of the platform Return the end of line character for the platform Return the available memory Return the directory where Basic Control Engine is located Return the platform id Return the path separator character for the platform Return the version of Basic Control Engine GFK 1305D GFK 1305D INI Files ReadIni ReadIniSection W rite lni Read a string from an INI file Read all the item names from a given section of an INI file Write a new value to an INI file Logical binary operators And Eqv Imp Not Or Xor Math Abs Atn Cos Exp Fix Int Log Random Randomize Rnd Sgn Sin Sqr Tan Miscellaneous Q Beep Inline Introduction Logical or binary conjunction Logical or binary equivalence Logical or binary implication Logical or binary negation Logical or binary disjunction Logical or binary exclusion Return the absolute value of a number Return the arc tangent of a number Return the cosine of an angle Return e raised to a given power Return the integer part of a number Return the integer portion of a number Return the natural logarithm of a number Return a random number between two values Initialize the random number generator Genera
102. ng a Dialog Box Template File cc ci 9 essen 4 30 Testing an Edited Dialog BOX cesus orenean ninpi en a o 4 31 Tootest your didlos e TTT 4 31 Pasting a Dialog Box Template into Your SCTipt esse 4 33 Px from Dialog EANO naiean e suhcateadghiacnsnteincsombaccasehariendeniasnes 4 33 Using a Custom Dialog Box in Your Script sss eee 4 34 Creaunora Dialog RCCOnd TTT 4 34 Putting Information into the Custom Dialog BOX sese 4 35 Displaying the Custony Dialog BOX T 4 36 Retrieving Values from the Custom Dialog BOX 4 37 Using a Dynamic Dialog Box in Your RCD eee 4 38 Making a Dialog Box Dynamic sss sese eee eee 4 39 Ia OOIS Role Asaminu area a a Ee a Oaie 4 41 Pile MEMU genie e a a A 4 41 TI L L 4 49 SSO O TTT 4 43 FAG lor MENU sacot cane Sonn AE E L 4 45 PICK Too ccsscxsensasiiavesyeust scsi a anasedeadvoseats a a TT 4 45 Contents Contents vil Contents viit Debugging Your Scripts 5 1 Aboutthe IDE DU CS T 5 1 AIS The IC WUC OC Im 11a seat bas coues te anmeeionscusedhoves oeudesananahomesanaiaenehosseduaicneasteacsnauondeseatonnaliectas 5 1 Fabricating Event RSK Ta TT 5 2 APT AGING Script EXECUTION TTT 5 3 Setting and Removing Breakpoimnt sees eee eee eee 5 5 CLIN SH POMAUS host ant a a OEA 5 5 Removing Bre ak pO TTT 5 7 Usnea VV ACN arable T 5 8 Modifying the Value of a Variable cccssssssssseeeeeceeceeeceesecseesaaseesseseeseeeeess 5 10 Running Your Programs 6 1 RUT T T A E 6 1 Suspending A Running Program sees sees eee eee eee 6 1 SlOp
103. ntrol s Information dialog box to indicate the file in which the picture is contained 1 Display the Information dialog box for the picture control or picture button control whose picture you want to specify 2 In the Picture source option button group select File 3 Inthe Name field enter the name of the file containing the picture you want to display in the picture control or picture button control Note By clicking the Browse button you can display the Select a Picture File dialog box and use it to find the file 4 Click the OK button or press Enter The picture control or picture button control now displays the picture you specified To specify a picture from a picture library Here s how to display a Windows bitmap or metafile from a library on a picture control or picture button control by first using the Dialog Box Information dialog box to specify the library and then using the control s Information dialog box to indicate the name of the picture 1 Display the Dialog Box Information dialog box 2 Inthe Picture Library field specify the name of the picture library that contains the picture s you want to display in your dialog box Note By clicking the Browse button you can display the Select a Picture Library dialog box and use it to find the library If you specify a picture library in the Dialog Box Information dialog box all the pictures in your dialog box must come from this library 3 Click the
104. ontrol or group box first followed immediately by the controls that you want to associate with it If the controls are not created in the correct order they will not be associated in your dialog box template and any accelerator key you assign to the text control or group box label will not work properly If you don t create controls in the most efficient order the resulting problems with tabbing order option button grouping and accelerator keys usually won t become apparent until you test your dialog box Although you can still fix these problems at that point as explained later in the chapter it will definitely be more cumbersome In short it s easier to prevent or at least minimize problems of this sort than to fix them after the fact Editing Custom Dialog Boxes 4 13 Editing a Custom Dialog Box 4 14 In the preceding section you learned how to create controls and determine where they initially appear within your dialog box In this section you ll learn how to make various types of changes to both the dialog box and the controls in it The following topics are included e Selecting items so that you can work with them e Using the Information dialog box to check and or change various attributes of items e Changing the position and size of items e Changing titles and labels e Assigning accelerator keys e Specifying pictures e Creating or modifying picture libraries under Windows e Duplicating and deleting control
105. ormation dialog box The Event Information dialog box allows you to fabricate the event information that the APIs would provide in a real environment Using this fabrication you can safely test the accuracy of your script To open the Event Information dialog box 1 Select Debug on the Program Editor menu bar 2 Select Set Event Information The Event Information dialog box opens Event Information Fa Event Type Alarm Generated clas ec DAVTVPE OV VERE MDS aim 3 6ner ale Alam ID 4CAL DAYTPE DV S gt Event ID EVENTI k T j Resource ID SYSTEM El gt Action ID ACTION sit Alarm Class HIGH S T Enmt po on Helo world meine Be p i Message 1 Available Fief Id fio H Req Acknowledged se Because you are using the Event Information dialog box to fabricate a real world environment what you enter depends on what is included in your script If the script includes specific entries for any of the fields you have to enter what is in the script For any entries that are not specifically referred to in the script you can enter whatever you want Example A script defines the Event Type as Alarm Generated Resource ID as SYSTEM As a result Alarm Generated and SYSTEM are selected in the Event Information dialog box Entries in the other fields are fictitious CIMPLICITY HMI Program Editor Operation Manual July 2001 GFK 1305D Whenever you run the script it will draw its inform
106. ovides key information about the operation you are currently performing including the name of the currently selected control or dialog box together with its position on the display and its dimensions the name of a control you are about to add to the dialog box with the mouse pointer together with the pointer s position on the display the function of the currently selected menu command and the activation of Dialog Editor s testing or capturing functions Note Dialog boxes created with Dialog Editor normally appear in an 8 point Helvetica font both in Dialog Editor s application window and when the corresponding code is run Editing Custom Dialog Boxes 4 3 Dialog Editor s Toolbar The following list briefly explains the purpose of each of the tools on Dialog Editor s toolbar which you can use to add controls to your dialog box make various changes to the dialog box and its controls and test the dialog box s functioning Icon id E E E E a E SIG IS ZW SIR IS S Tool Run Information Pick OK Button Cancel Button Push Button Option Button Check Box Group Box Text Text Box List Box Combo Box Drop List Box Picture Picture Button Function Runs the dialog box for testing purposes Displays the Information dialog box for the selected dialog box or control Lets you select move and resize items and control the insertion point Adds an OK button to your dialog box Adds a Cancel button to your
107. pe 8 Program Editor will not assign a new value if it cannot be converted to the same type as the specified variable Debugging Your Scripts Running Your Programs Running A Program Once you have finished editing your programs you will want to run it to make sure it performs the way you intended You can also pause or stop an executing script Here s how to compile your script if necessary and then execute it e Click the Start tool on the toolbar e Press F5 The script is compiled if it has not already been compiled the focus is switched to the parent window and the script is executed Suspending A Running Program Here s how to suspend the execution of a script that you are running e Press Ctrl Break or press the Break toolbar button Execution of the script is suspended and the instruction pointer a gray highlight appears on the line of code where the script stopped executing Note The instruction pointer designates the line of code that will be executed next if you resume running your script Stopping A Running Program Here s how to stop the execution of a script that you are running e Click the End tool on the toolbar GFK 1305D 6 1 Introduction GFK 1305D Appendix A Runtime Error Messages This section contains listings of all the runtime errors It is divided into two subsections the first describing errors messages compatible with standard Basic as implemented by Microsoft Visual
108. peat the trace command Each time you repeat the trace command Program Editor executes the line containing the instruction pointer and moves the instruction pointer to the next line to be executed When you finish tracing the execution of your script you can do one of the following e Click the Start tool on the toolbar or press F5 to run the balance of the script at full speed e Click the End tool to halt execution of the script Debugging Your Scripts 5 3 Displaying the Calls Dialog Box When you are stepping through a subroutine you may need to determine the procedure calls by which you arrived at that point in your script Here s how to use the Calls dialog box to obtain this information 1 Click the Calls tool on the toolbar Program Editor displays the Calls dialog box which lists the procedure calls made by your script in the course of arriving at the present subroutine updateitems CalcResult 2 From the Calls dialog box select the name of the procedure you wish to view 3 Click the Show button Program Editor highlights the currently executing line in the procedure you selected scrolling that line into view if necessary During this process the instruction pointer remains in its original location in the subroutine Moving the Pointer to Another Line When you are stepping through a subroutine you may want to repeat or skip execution of a section of code Here s how to use the Set Next Statement
109. pine A R nnine RST h TTT 6 1 Appendix A Runtime Error Messages 1 1 ETIT EA AE AA ere ieee rere rs EAT EA Tee my vere are ee T eee oer ere A 1 Visual Basic Compatible Error MeSSaS6 S scciciccssetdicnaseisatiadenexteocwecasetdaceacussacsadsbseonavediacseseties A 2 Basic Control Engine Specific Error Messages ccccccssssssssseseseeecceceeeeceseeaaaaaeessseeeeeeeeeees A 5 Appendix B Compiler Error Messages 2 1 Enor Te B Cpe nee ERE MPR OR oT AP nT eT ner Pe CNR A B 1 CIMPLICITY HMI Program Editor Operation Manual July 2001 GFK 1305D Introduction CIMPLICITY Functionality The CIMPLICITY Base System functionality Point Management Alarm Management and Data Logging facilities as well as a full functioned User Interface enables CIMPLICITY users to collect data from reporting and to visualize data via lists graphic status displays and alarms Standard data communications capability makes CIMPLICITY a factory floor tool that can provide services such as those listed below e Downtime reporting e Production reporting e Records of production counts at work stations e Graphic monitoring of automatic data point values e Fault reporting via direct point values and alarms CIMPLICITY software s flexible system architecture and modular design allows for ease add on of functionality The Basic Control Engine is a product option for GE Fanuc s CIMPLICITY software This option is fully integrated with CIMPLICITY software s Bas
110. property of the object Expecting 0 or 1 Boolean expression expected Numeric expression expected Numeric type FOR variable expected For Next variable mismatch Out of string storage space B 2 CIMPLICITY HMI Program Editor Operation Manual July 2001 GFK 1305D 64 65 66 67 68 69 70 72 74 75 76 71 78 79 80 81 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 101 102 103 104 Out of identifier storage space Internal error 1 Maximum line length exceeded Internal error 3 Division by zero Overflow in expression Floating point expression expected Invalid floating point operator Single character expected Subroutine identifier can t have a type declaration character Script is too large to be compiled Variable type expected Can t evaluate expression Can t assign to user or dialog type variable Maximum string length exceeded Identifier name already in use as another type Operator cannot be used on an object placeholder is not a property or method of the object Type character not allowed on label Type character mismatch on routine placeholder Destination name is already a constant Can t assign to constant Error in format of compiler extensions Identifier too long Expecting string or structure expression Can t assign to expression Dialog and Object types are not supported in this context Array expression not supported as parameter Dialogs objects and structures expressions are not s
111. rogram Editor Operation Manual July 2001 GFK 1305D GFK 1305D To assign an accelerator key Here s how to designate a letter from a control s label to serve as the accelerator key for that control 1 Display the Information dialog box for the control to which you want to assign an accelerator key 2 Inthe Text field type an ampersand amp before the letter you want to designate as the accelerator key 3 Click the OK button or press Enter The letter you designated is now underlined on the control s label and users will be able to access the control by pressing Alt the underlined letter Note Accelerator key assignments must be unique within a particular dialog box If you attempt to assign the same accelerator key to more than one control Dialog Editor displays a reminder that that letter has already been assigned If for example you have a push button whose label reads Apply you can designate A as the accelerator key by displaying the Push Button Information dialog box and typing amp Apply in the Text field When you press Enter the button label looks like the following illustration and users will be able to choose the button by typing Alt A Apply As another example let s say you have a list box that is immediately preceded in the dialog box template by a text control whose label reads 1994 Project Files By using the method described above you can designate F as the accelerator key When you click OK or
112. rols in a dialog box If you want to wipe the slate clean and start all over again with your dialog box here s how to remove all its controls in a single operation 1 Select the dialog box 2 Press Delete 3 Ifthe dialog box contains more than one control Dialog Editor prompts you to confirm that you want to delete all controls Click the Yes button or press Enter All the controls disappear but the dialog box s title bar and close box if displayed remain unchanged Undoing Editing Operations You can undo editing operations that produce a change in your dialog box including e The addition of a control e The insertion of one or more controls from the Clipboard e The deletion of a control e Changes made to a control or dialog box either with the mouse or with the Information dialog box You cannot undo operations that don t produce any change in your dialog box such as selecting controls or dialog boxes and copying material to the Clipboard To undo an editing operation Here s how to reverse the effect of the preceding editing operation e Press Ctrl Z Your dialog box is restored to the way it was before you performed the editing operation GFK 1305D Editing Custom Dialog Boxes 4 27 Editing an Existing Dialog Box There are three ways to edit an existing dialog box 1 You can copy the template of the dialog box you want to edit from a script to the Clipboard and paste it into Dialog Editor 2 You can us
113. s e Undoing editing operations Selecting Items In order to edit a dialog box or a control you must first select it When you select an item it becomes surrounded by a thick frame as you saw in the preceding section You may select a control or dialog box using either mouse or keyboard methods To select a control With the Pick tool active place the mouse pointer on the desired control and click the mouse button _Or With the Pick tool active press the Tab key repeatedly until the focus moves to the desired control The control is now surrounded by a thick frame to indicate that it is selected and you can edit it To select the dialog box With the Pick tool active place the mouse pointer on the title bar of the dialog box or on an empty area within the borders of the dialog box that is on an area where there are no controls and click the mouse button _Or With the Pick tool active press the Tab key repeatedly until the focus moves to the dialog box The dialog box is now surrounded by a thick frame to indicate that it is selected and you can edit it CIMPLICITY HMI Program Editor Operation Manual July 2001 GFK 1305D GFK 1305D Using the Information Dialog Box The Information dialog box enables you to check and adjust various attributes of controls and dialog boxes This subsection explains how to display the Information dialog box and provides an overview of the attributes with which it lets you
114. s tracing 5 4 script execution tracing 5 2 5 3 watch variables 5 8 adding 5 8 5 9 deleting 5 10 modifying value of 5 10 selecting 5 9 deleting controls in Dialog Editor 4 27 deleting text in Program Editor 3 6 dialog actions 4 40 Index i dialog boxes in Dialog Editor See also dialog controls dialog controls in Dialog Editor Dialog Editor user dialogs attributes of adjusting with Information dialog box 4 17 capturing from another application 4 29 4 30 creating 4 7 4 13 editing 4 1 4 144 27 incorporating dialog boxes or dialog controls into script 4 33 Information dialog box for displaying 4 15 moving with arrow keys 4 19 with Information dialog box 4 20 with mouse 4 19 opening dialog box template files in Dialog Editor 4 30 pasting dialog box controls into Dialog Editor 4 28 4 29 pasting dialog boxes into Dialog Editor 4 28 4 29 resizing 4 21 with Information dialog box 4 21 with mouse 4 21 selecting 4 14 testing 4 31 for basic problems 4 31 for operational problems 4 32 when there are hidden controls 4 20 titles of changing 4 22 dialog controls See also dialog controls in Dialog Editor adding in Dialog Editor 4 9 4 10 Cancel buttons in Dialog Editor 4 7 check boxes in Dialog Editor 4 8 combo boxes in Dialog Editor 4 8 deleting in Dialog Editor 4 27 drop list boxes in Dialog Editor 4 9 duplicating in Dialog Editor 4 26 group boxes in Dialog Editor 4 8 list boxes in Dialog Editor 4 8 moving i
115. sic Control Engine Components eee esse ee eee ee 1 2 Using the Basic Control Engine Language RGerenC sss eee 1 3 IR Elements Dy C WEZYR EO 1 4 AAY n a widen tong TTT 1 4 Cuppa TTT 1 4 ET ae E E A E E E EE oaaas 1 4 LOIS GDIR mina onp a ENEE T na 1 4 Controlling other protams esd WR ee ee 1 5 COMEOIMING Procram TOW srera aa a eueelna eeaondeaeni ei rtaens 1 5 Controlling the operating environment eee eee eee eee eee eee eee 1 6 ORY CESION THT 1 6 TETE A E Ra aA Z Ra REA E a an 1 7 NAA ASC AE EA E A T E E T cnet oa tietecesueteat A E A ate honk shine tneypecices l 7 TSS Ne a TT l 7 BDE kegingi n a o 1 8 Error handl No en e e eens sata e e A 1 8 Pe UL ar E E E E E 1 9 VS Sy SS ean E seeaumaaeeaadanedntesevonseees 1 9 Pinanc cts care natonscaiet en inhaieascetendvaee A tanntuascaamencucemonseeeaees 1 10 Getting information from Basic Control Engine sss sees 1 10 END TAT Ste sah cacti ccs yatta eacas E aneen cen tee when acne che haten encase 1 11 Logical binary Operators eee eee 1 11 Ter TTT 1 11 INV1S COM AIVE OUS errereen e aes eae snes cidasne E A senda ATE 1 11 Nomen C80 DEL ALOLS TTT 1 12 ODE Onea e e div daadeehdecnast 1 12 PAU STING L L geecanaeh E eas 1 12 PRreEGehiMed GialO GS isenana e iow ian ia eeat ace vee l 12 PITA OU L E 1 13 POC TT 1 13 SNE OPE ns5ciczasaceractsack sen basesaanisenadeisasoareusack onan E a aE basceecsoanes 1 13 ei 1 13 User TTT 1 14 eT LES ANd CONS CAIUS soccmacccpdacdava decane E wadedede sepaandsoans e
116. ss Ctrl G Dialog Editor displays the Grid dialog box Spacing Horizontal x 4 Yertical r 4 2 To display the grid in your dialog box select the Show grid check box 3 To change the current X and Y settings enter new values in the X and Y fields Note The values of X and Y in the Grid dialog box determine the grid s spacing Assigning smaller X and Y values produces a more closely spaced grid which enables you to move the mouse pointer in smaller horizontal and vertical increments as you position controls Assigning larger X and Y values produces the opposite effect on both the grid s spacing and the movement of the mouse pointer The X and Y settings entered in the Grid dialog box remain in effect regardless of whether you choose to display the grid 4 Click the OK button or press Enter GFK 1305D Editing Custom Dialog Boxes 4 1 4 12 Dialog Editor displays the grid with the settings you specified With the grid displayed you can line up the crosshairs on the mouse pointer with the dots on the grid to position controls precisely and align them with respect to other controls Dialog Editor Untitled File Edit Controls Help CheckBox Fana Push button a 8 Y 32 Width 48 Height 14 As you move the mouse pointer over the dialog box after you have chosen a control tool from the toolbar the status bar displays the name of the type of control you have selected and continually up
117. te a random number between 0 and 1 Return the sign of a number Return the sine of an angle Return the square root of a number Return the tangent of an angle Force parts of an expression to be evaluated before others Line continuation Make a sound Allow execution or interpretation of a block of text Numeric operators x A Mod Objects CreateObject GetObject Is Nothing Parsing Item ItemCount Line LineCount Word WordCount Multiply Add Subtract Divide Integer divide Power Remainder Instantiate an OLE automation object Return an OLE automation object from a file or returns a previously instantiated OLE automation object Compare two object variables Value indicating no valid object Return a range of items from a string Return the number of items in a string Retrieve a line from a string Return the number of lines in a string Return a sequence of words from a string Return the number of words in a string Predefined dialogs AnswerBox AskBox AskPassword InputBox InputBox MsgBox function MsgBox statement OpenFilename SaveFilename SelectBox I 12 CIMPLICITY HMI Program Editor Operation Manual July 2001 Display a dialog asking a question Display a dialog allowing the user to type a response Display a dialog allowing the user to type a password Display a dialog allowing the user to type a response Display a dialog containing a m
118. the Syntax of a Script 3 12 When you try to run or debug a script whose syntax hasn t been checked Program Editor first performs a syntax check automatically Here s how to perform a syntax check manually when you are editing your script without having to run it 1 From the File or the toolbar menu choose the Compile command The Program Editor either indicates that no errors have been found or displays an error message that specifies the first line in your script where an error has been found and briefly describes the nature of that error 2 Click the OK button or press Enter If Program Editor has found a syntax error the line containing the error is highlighted on your display 3 Correct the syntax error 4 Repeat steps 1 3 until you have found and corrected all syntax errors CIMPLICITY HMI Program Editor Operation Manual July 2001 GFK 1305D Editing Dialog Box Templates Here s how to invoke Dialog Editor and use it to create a new dialog box template for use in your script Inserting A New Dialog Box Template To insert a new dialog box template into your program 1 Place the insertion point where you want the new dialog box template to appear in your script 2 From the Edit menu choose the Insert Dialog command The Program Editor s application window is temporarily disabled and the Dialog Editor appears displaying a new dialog box in its application window 3 Use Dialog Editor to create your dialo
119. tion button check box group box and text Text Text box OK button Cancel button push button option button group box text picture and picture button Check box text box list box combo box and drop list box Picture picture button Picture List box combo box and drop list box Option button CIMPLICITY HMI Program Editor Operation Manual July 2001 Attribute Position X and Y coordinates within the dialog box in dialog units Size width and height of the control in dialog units Text text displayed on a control Font font in which text is displayed Multiline option that allows you to determine whether users can enter a single line of text or multiple lines Identifier name by which you refer to a control in your script code Identifier name by which you refer to a control in your script code also contains the result of the control after the dialog box has been processed Identifier name of the file containing a picture that you want to display or the name of a picture that you want to display from a specified picture library Frame option that allows you to display a 3 D frame Array name of an array variable in your script code Option Group name by which you refer to a group of option buttons in your script code GFK 1305D GFK 1305D Changing The Position of an Item Dialog Editor s display can be thought of as a grid in which the X horizontal axis a
120. tor Here s how to get out of Dialog Editor When you exit you can save your dialog box template that is the description of the dialog box as a text file 1 Press Alt F4 If you have made changes to your dialog box template Dialog Editor asks whether you want to save those changes 2 If you want to save your changes to a text file click the Yes button Dialog Editor displays the Save Dialog File dialog box which you can use to specify the file to which you want to save your template GFK 1305D Editing Custom Dialog Boxes 4 33 Using a Custom Dialog Box in Your Script After using Dialog Editor to insert a custom dialog box template into your script you ll need to make the following modifications to your script 1 Create a dialog record by using a Dim statement 2 Put information into the dialog box by assigning values to its controls 3 Display the dialog box by using either the Dialog function or the Dialog statement 4 Retrieve values from the dialog box after the user closes it Creating a Dialog Record To store the values retrieved from a custom dialog box you create a dialog record with a Dim statement using the following syntax Dim DialogRecord As DialogVariable Here are some examples of how to create dialog records Dim b As UserDialog Define a dialog record b Dim PlayCD As CDDialog Define a dialog record PlayCD Here is a sample script that illustrates how to create a dialog record nam
121. trol with crosshairs for positioning purposes to its upper left The name and position of the selected control appear on the status bar When you pass the pointer over an area of the display where a control cannot be placed the pointer changes into a circle with a slash through it the prohibited symbol The control you just created appears at the specified location To be more specific the upper left corner of the control will correspond to the position of the pointer s crosshairs at the moment you clicked the mouse button The control is surrounded by a thick frame which means that it is selected and it may also have a default label After the new control has appeared the mouse pointer becomes an arrow to indicate that the Pick tool is active and you can once again select any of the controls in your dialog box To add another control of the same type as the one you just added press Ctrl D A duplicate copy of the control appears To add a different type of control repeat steps 1 and 2 To reactivate the Pick tool you can do one of the following e Click the arrow shaped tool on the toolbar e Place the mouse pointer on the title bar of the dialog box or outside the borders of the dialog box that is on any area where the mouse pointer turns into the prohibited symbol and click the mouse button As you plan your dialog box keep in mind that a single dialog box can contain no more than 255 controls and that a dialog bo
122. tside the Current Subroutine If you want to continue debugging at a line that isn t within the same subroutine here s how to move the instruction pointer to that line 1 Place the insertion point in the line where you want to continue debugging 2 To set a breakpoint on that line press F9 3 Torun your script click the Start tool on the toolbar or press F5 The script executes at full speed until it reaches the line containing the breakpoint and then pauses with the instruction pointer on that line You can now resume stepping through your script from that point Debugging Selected Portions of a Program If you only need to debug parts of your script here s how to facilitate the task by using breakpoints 1 Place a breakpoint at the start of each portion of your script that you want to debug Note Up to 255 lines in your script can contain breakpoints 2 Torun the script click the Start tool on the toolbar or press F5 The script executes at full speed until it reaches the line containing the first breakpoint and then pauses with the instruction pointer on that line 3 Step through as much of the code as you need to 4 To resume running your script click the Start tool on the toolbar or press F5 The script executes at full speed until it reaches the line containing the second breakpoint and then pauses with the instruction pointer on that line 5 Repeat steps 3 and 4 until you have finished debugging the selecte
123. ultiple threads of execution e Dialog Editor e On Line Help Wizards You can use the Wizards to automatically generated procedure or function calls You fill in the blanks and the wizard generates the code The wizards are located on the Tools toolbar The Tools toolbar default location is on the left side of the screen You can use the wizards to generate e Point access functions e Alarm manipulation functions e Error logging functions that send messages to the CIMPLICITY Status Log 2 1 You can also use the right mouse button to bring up a popup menu containing the wizards while you are editing a document You can also create points on your devices while you are in the wizards Watch Window You can use the watch feature to place commonly used variables into a watch windows When you step over a line or when execution of the program pauses the values of the variables in the watch window are updated Currently the watch window does not support object inspection user defined structures or arrays however you may view single elements of an array using the lt array gt lt element gt syntax These features are available from the QuickWatch inspector The watch window size can be adjusted by dragging the separator QuickWatch Object Inspector You can use the QuickWatch object inspector to inspect variables objects arrays and user defined types UDT s Simply select a variable in the program and press the Qu
124. upported as a parameter Invalid numeric operator Invalid structure element name following Access value can t be used with specified mode Invalid operator for object Can t LSet a type with a variable length string Syntax error placeholder is not a method of the object GFK 1305D Appendix B Compiler Error Messages B 3 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 22 123 124 125 126 127 128 129 130 131 132 133 134 135 No members defined Duplicate type member Set is for object assignments Type character mismatch on variable Bad octal number Bad number End of script encountered in comment Misplaced line continuation Invalid escape sequence Missing End Inline Statement expected ByRef argument mismatch Integer overflow Long overflow Single overflow Double overflow Currency overflow Optional argument must be Variant Parameter must be optional Parameter is not optional Expected Lib Illegal external function return type Illegal function return type Variable not defined No default property for the object The object does not have an assignable default property Parameters cannot be fixed length strings Invalid length for a fixed length string Return type is different from a prior declaration Private variable too large Storage space exceeded Public variables too large Storage space exceeded B 4 CIMPLICITY HMI Program Editor Operation Manual Jul
125. urrent drive Return the current directory Return files in a directory Fill an array with valid disk drive letters Return the free space on a given disk drive Return the mode in which a file is open Copy a file Return the date and time when a file was last modified Fill an array with a subdirectory list Determine if a file exists Return the length of a file in bytes 1 9 FileList FileParse GetAttr Kill MkDir Name RmDir SetAttr Financial DDB Fv IPmt IRR MIRR NPer Npv Pmt PPmt Pv Rate SIn SYD Fill an array with a list of files Return a portion of a filename Return the attributes of a file Delete files from disk Create a subdirectory Rename a file Remove a subdirectory Change the attributes of a file Return depreciation of an asset using double declining balance method Return the future value of an annuity Return the interest payment for a given period of an annuity Return the internal rate of return for a series of payments and receipts Return the modified internal rate of return Return the number of periods of an annuity Return the net present value of an annuity Return the payment for an annuity Return the principal payment for a given period of an annuity Return the present value of an annuity Return the interest rate for each period of an annuity Return the straight line depreciation of an asset Return the Sum of Years Digits depreciation of an asset Getting i
126. urself some work later on but you may also find that your changes make the script code produced by Dialog Editor more readily comprehensible and hence easier to work with The Dialog Box Information dialog box can be used to check and adjust the following attributes which pertain to the dialog box as a whole Mandatory Optional Attribute Optional Position X and Y coordinates on the display in dialog units Mandatory Size width and height of the dialog box in dialog units Optional Style options that allow you to determine whether the close box and title bar are displayed Optional Text text displayed on the title bar of the dialog box Mandatory Name name by which you refer to this dialog box template in your script code Optional Function name of a script function in your dialog box Optional Picture Library picture library from which one or more pictures in the dialog box are obtained GFK 1305D Editing Custom Dialog Boxes 4 17 Attributes That You Can Adjust with the Information Dialog Box for a Control The Information dialog box for a control can be used to check and adjust the following attributes The second column of the list indicates the control s to which each attribute pertains Mandatory Optional Mandatory Mandatory Optional Optional Optional Optional Mandatory Optional Optional Mandatory Mandatory 4 18 Control s Affected All controls All controls Push button op
127. ustom dialog boxes and to edit dialog boxes captured from other applications You ll also learn how to test an edited dialog box and incorporate the dialog box template generated by Dialog Editor into your script And finally you ll learn how to exit from Dialog Editor Features of the Dialog Editor Dialog Editor supports the following features e Visual editing of a dialog box template in a script e The creation of dynamic dialog boxes 4 2 CIMPLICITY HMI Program Editor Operation Manual July 2001 GFK 1305D Using the Dialog Editor GFK 1305D This section presents general information that will help you work most effectively with Dialog Editor It includes an overview of Dialog Editor s application window the interface you ll use to create and edit dialog box templates in a script as well as a list of keyboard shortcuts and information on using the Help system Dialog Editor s Application Window Before you begin creating a new custom dialog box Dialog Editor s application window looks like this Dialog Editor Untitled Controls Help Toolbar Dialog box Status bar Dialog a 10 Y 22 Width 180 Height 96 The application window contains the following elements e Toolbar a collection of tools that you can use to provide instructions to the Dialog Editor as discussed in the following subsection e Dialog box the visual layout of the dialog box that you are currently creating or editing e Status bar pr
128. v CIMPLICITY HMI Program Editor Operation Manual July 2001 GFK 1305D Program Editor Toolbars U Application Toolbar 2 11 Standard Toolbar 2 10 undo Tools Toolbar 2 11 in Dialog Editor 4 27 push buttons in Program Editor 3 7 in Dialog Editor 4 7 UES idle processing for 4 40 Q list of language elements 1 14 QuickWatch Object Inspector V Program Editor 2 2 l variables list of language elements 1 15 R watch in Program Editor 5 8 5 10 variants replacing text in Program Editor 3 11 resizing controls in Dialog Editor 4 21 dialog boxes in Dialog Editor 4 21 runtime errors A 2 A 4 W list of language elements 1 15 Visual Basic error messages A 2 watch variables in Program Editor 5 8 S adding 5 8 5 9 deleting 5 10 modifying value of 5 10 selecting 5 9 Watch Window Program Editor 2 2 searching for text in Program Editor 3 10 selecting controls in Dialog Editor 4 14 dialog boxes in Dialog Editor 4 14 selecting text in Program Editor 3 4 3 5 Shortcut Keys Window Components Program Editor 2 12 Program Editor 2 4 status bar Wizards in Dialog Editor 4 3 Program Editor 2 1 Step In Program Editor 2 2 Step Over Program Editor 2 2 string operators list of 1 13 strings list of language elements 1 13 syntax checking in Program Editor 3 12 T testing dialog boxes in Dialog Editor 4 20 4 31 4 32 text boxes in Dialog Editor 4 8 4 32 text controls in Dialog Editor 4 8 toolbar in Dialog Editor 4 3 4 4
129. work In the following subsections you ll learn more about how to use the Information dialog box to make changes to your dialog box and its controls e You can use the Dialog Box Information dialog box to check and adjust attributes that pertain to the dialog box as a whole e You can use the Information dialog box for a control to check and adjust attributes that pertain to that particular control To display the Information dialog box for a dialog box With the Pick tool active place the mouse pointer on an area of the dialog box where there are no controls and double click the mouse button _Or With the Pick tool active select the dialog box and either click the Information tool on the toolbar press Enter or press Ctrl l Dialog Editor displays the Dialog Box Information dialog box Dialog Box Information Position ie E m T oo Height 76 lent Untitled Wariable Name Hame UserDialog Function Picture hran T Variable Name Editing Custom Dialog Boxes 4 16 To display the Information dialog box for a control With the Pick tool active place the mouse pointer on the desired control and double click the mouse button _Or With the Pick tool active select the control and either click the Information tool on the toolbar press Enter or press Ctrl l Dialog Editor displays an Information dialog box corresponding to the control you selected Here is an example Push Button Information
130. x will not operate properly unless it contains either an OK button a Cancel button a push button or a picture button When you create a new custom dialog box an OK button and a Cancel button are provided for you by default Later in the chapter you ll learn more about selecting controls and you ll learn how to assign labels CIMPLICITY HMI Program Editor Operation Manual July 2001 GFK 1305D Using the Grid to Help You Position Controls within a Dialog Box The preceding subsection explained how to determine approximately where a newly created control will materialize in your dialog box Here you ll learn how to use Dialog Editor s grid to help you fine tune the initial placement of controls The area of your dialog box in which controls can be placed that is the portion of the dialog box below the title bar can be thought of as a grid with the X horizontal axis and the Y vertical axis intersecting in the upper left corner the 0 0 coordinates The position of controls can be expressed in terms of X units with respect to the left border of this area and in terms of Y units with respect to the top border In fact the position of controls is expressed in this manner within the dialog box template that you produce by working with Dialog Editor Here s how to display the grid and adjust its X and Y settings which can help you position controls more precisely within your dialog box To display and adjust the grid 1 Pre
131. y 2001 GFK 1305D Index A About Editing Programs 3 1 accelerator keys in Dialog Editor 4 13 assigning to dialog controls 4 22 4 23 testing 4 32 actions dialog 4 40 arrays list of language elements 1 4 B BasicScript functions to get information from 1 10 binary operators list of 1 11 Breakpoints Program Editor 2 2 breakpoints in Program Editor 5 5 removing 5 7 setting 5 5 5 6 buttons on toolbar in Dialog Editor 4 4 C Cancel buttons in Dialog Editor 4 7 capturing dialog boxes from another application in Dialog Editor 4 29 4 30 check boxes in Dialog Editor 4 8 Clipboard list of language elements 1 4 combo boxes in Dialog Editor 4 8 comments adding to scripts in Program Editor 3 8 list of language elements 1 4 GFK 1305D comparison operators list of 1 4 compiler errors B 1 B 4 constants list of language elements 1 15 control structures list of 1 5 controlling applications list of language elements 1 5 copying text in Program Editor 3 7 creating dialog boxes in Dialog Editor 4 7 4 13 cutting text in Program Editor 3 7 D data conversion list of language elements 1 6 data types list of 1 7 database list of language elements 1 7 date time functions list of language elements 1 7 DDE list of language elements 1 8 debugging scripts in Program Editor 5 1 breakpoints 5 5 removing 5 7 setting 5 5 5 6 instruction pointer 5 1 moving to another line in subroutine 5 4 procedure call

Download Pdf Manuals

image

Related Search

Related Contents

Elgato Eye TV Hybrid User's Manual  Extron electronic 15HD User's Manual  FT LINGE - l`aidant de sagesse  Mode d`emploi du moniteur sans fil TL-2100GU-R1  Magnat Interior 5001A  Tecumseh AKA4460YXDXA Performance Data Sheet  PINTURA ANTIHUMEDAD  Samsung SGH-C140 Наръчник за потребителя  Cisco Systems PA-4R User's Manual    

Copyright © All rights reserved.
Failed to retrieve file