Home

OPTOTERMINAL™ QLARITY FOUNDRY™ USER'S MANUAL

image

Contents

1. Download other BFF Upgrade firmware o pee Clear results box Close Window J Open serial port whenever this screen is shown a 39 7 4 2 Prepare Terminal for Upgrade To prepare the terminal to receive new firmware using a serial or Ethernet connection set the App Mode option to either Develop or Download Refer to Chapter 7 of the OptoTerminal Hardware User s Manual for instructions NOTE if you cannot access the terminal If you cannot access the OptoTerminal use the Induce Bootloader function refer to section 7 4 4 for informa tion 7 4 3 Download New Firmware Do the following to download a new version of the Qlarity based firmware 1 Select Download Application from the File menu The following dialog box appears E Download application to unit Download pp download size 4607 Flash required 64 kbytes Download application Download other BFF Upgrade firmware Serial Ethemet Port com Baud rate 115200 Data Format ani Send sting over serial connection ana Te Induce Set unit time eee Results E Close Window a 4 Open serial port whenever this screen is shown 2 Click Upgrade firmware to proceed and the follow ing dialog box is displayed Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 40 3 GlarityFoundry EX ES 3 bl_1005 bin a a70c bin a
2. 3 Inthe Select Library box select the library to which you want the object template copied 4 The Entry Name box displays the name of the object template To assign 1t a different name within the library type a new name 5 If you want to leave the template in the current work space after you copy 1t to the library select Leave tem plate in workspace when done 6 Click OK to place the object template in the selected library 23 5 2 Edit Resources Resources include all bitmap images fonts audio files and binary data files that are available in a workspace and even tually in the user application You must add resources to a workspace before you can use them in object instances Use the Edit Resources option to add resource files to your workspace or to change or remove the resources available Because resources become part of the user application when it is compiled you should delete any unnecessary resources NOTE default bitmaps and fonts When you create a new workspace you have the option to add default bitmap images and fonts to your workspace Some objects may require at least one bitmap BDF font or TT font resource before the object will function properly When you have finished creating a workspace however you may want to remove any unused default bitmaps and fonts before you download the user application to the termi nal to conserve the terminal s flash and RAM memory Click 4
3. Closed indicates whether the Foundry gt should connect the first and last grips gt to make a closed object xCoords gt yCoords and cursors should all contain gt the same number of elements when this gt function completes 77 func ToolGetHandles xCoords as gt reference to integer yCoords as reference to integer cursors as reference to GuiCursors closed as reference to boolean handles MSG TOOL GETHANDLES dim csrs 8 init csrs as GuiCursors CSR_UPLEFT CSR_UPDOWN gt CSR_UPRIGHT CSR_LEFTRIGHT gt CSR_DOWNRIGHT CSR_UPDOWN gt CSR_DOWNLEFT CSR_LEFTRIGHT redim xCoords 8 redim yCoords 8 xCoords 0 xPos xCoords 1 xPos width 2 1 xCoords 2 xPos width 1 xCoords 3 xCoords 2 xCoords 4 xCoords 2 xCoords 5 xCoords 1 xCoords 6 xPos xCoords 7 xPos yCoords 0 yPos yCoords 1 yPos yCoords 2 yPos yCoords 3 yPos height 2 1 yCoords 4 yPos height 1 yCoords 5 yCoords 4 yCoords 6 yCoords 4 yCoords 7 yCoords 3 cursors csrs closed true endfunc The MSG_TOOL_GETHANDLES message is sent to an object by Qlarity Foundry when the object is created All objects receive this message when a workspace is initial ized Qlarity Foundry requests the locations of the resize grips sizing handles that are drawn on an object when it is selected The handler is passed references to three arrays xCoords yCoords and c
4. El a The message includes a description of the error includ mg the object and line number where the error occurred Double clicking the error message in the Messages and Errors window takes you to the location of the error in Code View NOTE no errors If there are no errors found during the compile the work space 1s automatically returned to Layout View Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 OptoTerminal Qlarity Foundry User s Manual 9 5 Global Code In addition to method overrides an application can be cus tomized by adding variables and functions to the Global Code space Global variables can be used to hold data not stored in objects Global functions can implement com monly performed routines that might be shared by many objects Also most messages can be handled by global event handlers if desired Event handlers are special func tions that are called by the system software when the mes sage that the function handles is processed Since global functions are not overrides there are few restrictions on the names parameters or return type for glo bal functions 9 5 1 Add a Global Variable to a Workspace A global variable is a variable that is declared in the Global Code space outside of any object To add a global variable to the workspace do the following l Select the Global Code space by clicking Globals in the Object Tree 2 Click the Code
5. box If no further message is displayed the loading using the terminal s Power On Setup utility terminal s time has been set If an error occurs it is dis Refer to Chapter 7 of the OptoTerminal Hardware played in the Results box as shown below User s Manual for instructions NOTE time set through serial port The time is set through the serial port connection If your Error setting clock terminal is connected to an Ethernet port you will need to change it to a serial port to perform this function 2 Click Set Unit Time bottom of the Serial tab Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 42 OptoTerminal Qlarity Foundry User s Manual Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 CHAPTER 8 BASIC DESIGN You can use Qlarity Foundry to design a user application using library objects and or existing object templates This basic design requires no special programming skills This chapter provides instructions for using Qlarity Foundry to design a user application using only the objects and tem plates provided as well as information on the basic con cepts of the Qlarity programming language All Qlarity Foundry users should review and become famil iar with the information in this chapter If you want to learn more about using Qlarity Foundry and Qlarity program ming you can then proceed to Chapter 9 Intermediate Design
6. In the Template Name box type a name for the new template Each template in the workspace must have a unique name A template name has no size limitation but must start with a letter A name cannot contain spaces but may use the underline character _ The percent pound and dollar sign symbols can be used at the end of the name Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 22 4 The last box is labeled either Object Type or Based on depending on the option you selected In the Object Type box select the type of object you are creating from the drop down list as follows An object that contains other objects e g a form It can be defined as part or all of the terminal screen Container l A display element e g text object bitmap object line object etc An object that serves a function not related to the display e g key defi nition communications etc Non drawable object For more information on object types refer to Chapter 8 Basic Design and to Appendix A Glossary of Software Terms In the Based on box select the library object on which the new object template is to be based The pro gramming code from the library object will be copied to the new object template 5 Click OK to create the new template 5 1 2 Edit Icon Each template is identified in the Object Tree by an icon To customize the icon fo
7. This property receives the data string that is to be sent through the Ethernet port Data can be sent to this property from an Ethernet object configured in Event Builder see section 8 4 or an EZObject see Appendix B When the Ethernet object s sendtoport property receives data it automatically sends the data followed by a semicolon out the port protocol Enter the protocol to be used to send the data e g UDP or TCP localport Enter the address for the UDP or TCP port on the Qlarity based For additional information refer to your Ethernet protocol or contact your network administrator foreignport Enter the address for the UDP or TCP port on the host For additional information refer to your Ethernet protocol or contact your network administrator targetipaddress Enter the IP address of the device to which you are sending data connected This property reflects the connected status of the Ethernet object appendterminator This property determines whether a semicolon is appended to the end of all data sent out the Ethernet port 59 8 5 3 Receive Data You can send data from an external device e g computer to a OptoTerminal via the port serial or Ethernet To do this you specify an object and its property to receive the data in a user application This changes the specified prop erty value to the received data value Use the following format to send data to a user application lt Object n
8. which is called by the object each time a preset time period expires The function in the template does noth ing but it allows instances to override the function to pro vide a desired response to the timer expiration The code for the method override is defined inside the object instance The override method must have the same name parameters and return type as the template method that is being overridden For example if the method in the 63 template is named foo and it takes an integer and a float as parameters and returns a float then the override function must also be named foo and must also take an integer and a float as parameters in the same order as the template method and return a float In addition if the template method handles one or more messages the override must handle the same message s This may require you to examine the code in the template possibly in a library Otherwise the method is like any other Qlarity function and may contain whatever Qlarity code is desired The special function Default when placed inside an over ride method calls the overridden method in the template The same parameters that were passed to the override method should be passed in Default Refer to the OptoTerminal Programmer s Reference Man ual section 2 12 Functions for information on how func tions are defined in Qlarity NOTE create a new template If you find that you are adding identi
9. Homebutton Source 012 Line Source 0 10 Mextbuttorn Source 012 Mextbuttorn Bitmap 0 00 Polvline Source 0 10 NOTE use caution in editing libraries Changes that you make to libraries take effect immediately and cannot be undone Remember that a library may be used in more than one workspace and changes made to the library affect every workspace in which it is loaded You can change the library name version or icon colors as well as change the entries in the library Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 28 Name To change the library s name click in the Name text box and type over the existing entry The change is reflected in the Filename column in the Libraries dialog box Version To change the version number of the library click in the Version text box and type over the existing number The change is reflected in the Status column in the Libraries dialog box Icon Foreground Icon Background On the Object Palette icons for all objects in a library use a common color scheme Use these options to specify or change the foreground and or background color of the library s object icons Click Icon Foreground or Icon Background and a color palette is displayed A rectangle appears around the current foreground or background color Click a different color square to change the color then click OK 5 3 3 1 Edit Entry Click an object template e
10. Some objects have a default starting size and shape so the size of the rectangle doesn t matter only its posi tion in the work area The size of other objects such as a line or rectangle is initially determined by the size of the rectangle you draw If you are adding a non drawable object the location in the work area doesn t matter since the object is not part of the display You may want to use the shortcut menu to add a non drawable object in its default position see section 8 3 1 2 Add an Object From the Shortcut Menu for information Refer to Appendix B for more information on non drawable objects NOTE add multiple instances of the same object type To add more than one instance of the same type of object press and hold the lt Shift gt key when you click the object icon The object type remains selected and you can just click and drag in the workspace to add objects until you release the lt Shift gt key 4 After you add an object it remains selected and its object properties are displayed Click the Name property and type a name for the new object type over the default name Each object in the workspace must have a unique name An object name has no size limita tion but must start with a letter A name cannot contain spaces but may use the underline character _ The percent pound and dollar sign symbols can be used at the end of the name Refer to section 8 3 2 for information on mov
11. 2 Click Download Application to proceed A progress graph tracks the download and the Results box dis plays messages indicating whether the download was successful OptoTerminal Qlarity Foundry User s Manual If an error occurs verify that your communications set tings are correct Power the terminal off and back on and once again place the terminal in the proper mode Repeat the download process NOTE clear results Click Clear Results Box to clear the messages in the Results box 7 3 Download a BFF File You can download a user application that is not currently loaded in Qlarity Foundry to the OptoTerminal but the file must be in binary file format BFF Save a file to BFF using the Generate BFF function on the File menu see section 4 6 Click Download Other BFF and the following dialog box is displayed Open E GlarityFoundry S ee Look irr File name stidergauge bff Files of type Clarity application binary files bff Cancel All BFF files in the default folder are listed change folders if necessary Click the file that you want to download and click Open A progress graph tracks the download and messages in the Results box indicate whether the download was success ful 7 4 Upgrade the Firmware Use the Upgrade Firmware function to download a new version of the terminal resident software firmware to the OptoTerminal e Refer to s
12. 33 GBD A o co oo N aaae tenet eet 33 04 COMMONS nesan e totale sua deat een tone cate a eb a a oy wea alee ad tds 33 050 ImMu Onoto ee eee 34 MS OE ie A A taceseras 35 63 2 Communications Window Settings bi 35 BO Keypad CCITT SS dit 36 CHAPTER 7 DOWNLOAD SOFTWARE TO THE TERMINAL seccstesccescsssesccsscanetscdeadenseccsessenscecsrasescsccdsessvesctedsseseecceidesseeded dusssudssesesesudesccseesedeos 37 TL Conticure Communications POUL stat ads 37 la Sertal Port Seu eS ecne E a E 37 Tel 2 D a A BOE 5 CIM OS ads 37 TD Downoad a User A Pp i Atl OM i epee ese E a oun en oar NO 38 Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 OptoTerminal Qlarity Foundry User s Manual iii T21 Prepare the Terminal Tor Downloadihi rial 38 7 222 Download the User AppHCatl OF re a aer a a ra r aa aA e a E EEEE 38 Los DOWaload ABEP FE eiiie A E E A 38 Te Upo rade A A EEE 38 141 Determine Current Firmware Ver Mei 39 74 2 Prepare Terminal Tor U perdes ia aa 39 TS Download New PEDIA rios 39 DAA leo o A II A 40 ADS ECU Md E A e S N 40 CHAPTER 8 BASIC DESIGN A A E 43 8 1 Prepare Qlanty Foundry for Application Desi 43 Ml AAA O ON 43 3 12 Simulate the sh ermal DIS play iia 44 SADA TN O Sc rch wcrc elo cease fone se A S ce AE alte ee see eesti E A cita 45 Bel AINA REMOVE RESOUICES il T E E eaters 45 iy Add Remove A a a a a A A a EEE AA EE 46 1 5 1 Libraries Provided with Olarity Foundiy A A 46
13. 709 bin a hwset bin a mtc biri a mtg bir Look irr File name Files of type Clarity firmware binary files bir Cancel 3 Select the firmware upgrade file to be downloaded and click Open A progress graph tracks the download Messages in the Results box indicate whether the download was suc cessful When finished the new firmware version 1s shown in the Results box 7 4 4 Induce Bootloader If the firmware on your OptoTerminal has become corrupt and you cannot run the Power On Setup utility use the Induce Bootloader function to upgrade or reinstall the firmware NOTE Ethernet connection If your terminal is connected to an Ethernet port you will need to change it to a serial port to perform this function Do the following to download a new version of the Opto Terminal firmware 1 Select Download Application from the File menu 2 Click Induce Bootloader and an Inducing Boot loader message is displayed in the Results box After a time the following message is displayed Bootloader induction terminated Followed by the message NOTICE received command from host to enter bootloader Entering Opto 22 Bootloader V1 014 3 Click Upgrade firmware to proceed and the follow ing dialog box is displayed OptoTerminal Qlarity Foundry User s Manual 3 GlarityFoundry EX 3 b_ 1005 bin a a7 0c bin a a7 0g bin a hwse
14. CONVENTIONS Within Qlarity Foundry functions can be selected using a mouse a keyboard shortcut or an icon on a toolbar The following conventions are used to identify selections in this manual When instructed to press a specific key it is shown in a bold sans serif typeface and is lt Enter gt enclosed in angle brackets When instructed to press a key and hold it down while typing another key the keys are E P y a YPINE y lt CTRL gt lt V gt shown together When instructed to click a button or icon it is shown in a bold sans serif typeface and is enclosed in square brackets Icons on toolbars are represented graphically When instructed to type a character or a word it is shown in the Courier typeface Directory paths file names and file name extensions are indicated by italics Syntax commands and examples are shown in the Courier typeface Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 CONTENTS CHAPTER 1 INTRODUCTION a 1 il Howto Use This Manta A a dle l A PP O e uo O En o E O E PR E O e l CHAPTER 2 INSTALLATION aan 3 ZA Syster a an AAA ee a Perez Bi EOI A ses 3 22 MS ta Mam POUM tii rd dolida 3 CHAPTER 3 GETTING STARTED AA E a E 5 Sel Stare larity OU crei mn oasenees 5 Ore OPENA WY OL SAC cic tices a e E E a a S 5 LNN dO AA e a O SA 6 SANDT ODOT AAA o o E A a N 7 A a A aahanaahadeaeuet 7 o LTE IN AU aed Ge dd ES 8 NE MS id 8 44 Tools Menu Layout View Only canta A
15. EXLEV_MIN This level represents the minimum severity for an excep tion The exception type is an error code that describes the cause of the error Each exception type is accompanied by a short text description of the problem The error code provides a convenient means for Qlarity exception handlers to deter mine what error occurred while the description provides a readable summary of the exception The location string indicates the Qlarity function or system software facility that was executing when the error occurred This is useful for debugging the application Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 OptoTerminal Qlarity Foundry User s Manual The error codes and descriptions are listed in Appendix B Exception List of the OptoTerminal Programmer s Refer ence Manual Exception handling code is supported in the Qlarity pro gramming language by check error on error blocks When an exception occurs the Qlarity execution engine determines if the offending code is inside a check error block If so execution immediately jumps to the first state ment in the on error block If the offending code is not in a check error block the Qlarity execution engine checks the function that called the current Qlarity function for an enclosing check error block This process iterates until either an enclosing check error block is found or the mes sage handler
16. GS CORPORATION FOR THE GLARITY FOUNDRY SOFTWARE ACCOMPANYING THIS EULA WHICH INCLUDES COMPUTER SOFTWARE SAMPLE OBJECTS AND MAY INCLUDE ASSOCIATED Do you accept all the terme of the preceding License Agreement IF you choose No the setup will cloze To install Qlarity Foundry 1 51 vou must accept this agreement lnetallehreld No Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 5 Read the agreement and click Yes if you accept the terms The following window appears InstallShield wizard Choose Destination Location Select folder where Setup will install files Setup will install Qlarty Foundry 1 51 in the following folder To install to this folder click Next To install to a different folder click Browse and select another folder Destination Folder C Program Files Q5 Corporation Qlanty Foundry Browse lnetallehreld Cancel 6 Accept the destination folder shown or click Browse to select a different folder or create a new folder in which to install Qlarity Foundry Click Next to con tinue The following window appears InstallShield Wizard Setup Type Choose the setup type that best suits pour needs Click the type of Setup you prefer Install the features commonly required for Clarity Foundry 1 51 The application and help files will be installed as well as some sample programs and basic tutorials Inetall
17. NT requires Service Pack 6 2 2 Install Qlarity Foundry To install Qlarity Foundry take the following steps 1 Close any open Windows applications 2 Insert the Qlarity Foundry CD ROM into your CD ROM drive The Setup program should auto start If it does not click Start and click Run The following window appears Type the name of a program folder document or Internet resource and Windows will oper it for you Open F setup exe Cancel Browse 3 Type e setup in which e is the letter of your CD ROM drive The following window appears InstallShield Wizard Welcome to the InstallShield Wizard for Qlarity Foundry 1 51 The InstallShield Wizard will install Qlarity Foundry 1 51 on pour computer To continue click Next 4 If no other Windows based applications are running click Next and the License Agreement window is dis played InstallShield Wizard License Agreement Please read the following license agreement carefully Press the PAGE DOWN key to see the rest of the agreement END USER LICENSE AGREEMENT FOR O51 CORPORATION SOFTWARE IMPORTANT READ CAREFULLY BY CLICKING THE ACCEPTANCE BUTTON OF INSTALLING THE SOFTWARE VOU ARE CONSENTING TO BE BOUND Er AND ARE BECOMING A PARTY TO THIS END USER LICENSE AGREEMENT THIS END USER LICENSE AGREEMENT EULA IS A LEGAL AGREEMENT BETWEEN YOU EITHER AN INDIVIDUAL OR A SINGLE ENTITY AND
18. Qlarity Foundry Select this option to identify the version of Qlarity Foundry BFF and the firmware that you are running 3 5 Toolbar The Qlarity Foundry toolbar contains icons for commonly used functions Click an icon to open the function Select Toolbar from the View menu to show or hide the toolbar The following sections describe the tools available on the toolbar in Layout View and Code View 3 5 1 Layout View Toolbar Os Gee 5 9 BAM 4 im Click to start a new workspace Refer to section 4 1 for information Gf Click to open an existing workspace Refer to section 4 2 for information Fl Click to save the current workspace Refer to section 4 4 for information S Click to compile the current workspace into the for mat required for a user application A workspace also must be compiled to properly display in Layout View Refer to section 4 5 for information on compiling a workspace fa Click to open the Download Application dialog box Refer to Chapter 7 Download Software to the Ter minal for information Ed Select an object in the work area then click Es to cut the object from the workspace The object remains in the Windows buffer until replaced by another cut or copy operation JN OptoTerminal Qlarity Foundry User s Manual Select an object in the work area then click to make a copy of the object The object remains in the Windows buffer until replaced by another cut or
19. Use the value of this object property Object Tank slider Z Froperty float Property to Set Object Tank_gauge hl Property value Use this explicit value El In the Property to Set section select the target object object to be changed when the event takes place such as moving a gauge from the Object drop down list From the Property drop down list select the target property property to be changed by the action Use one of the following options to complete the configura tion Set to this value Select Use the value of this object property Then select the source object from the Object drop down list and the source property from the Property drop down list In the example above the target and source properties both use the value property but any com patible property can be used For example if the target object is a label you might select the caption prop erty Use this explicit value For some properties you may need to enter or select an explicit value For example if you want your own mes sage displayed when a button is pressed enter the mes sage in this text box A drop down list may appear with available values depending on the object selected Some objects may require additional configuration such as selecting a color If additional configuration is available for the selected object a ES button appears next to the text box NO
20. View tab The editor window displays any current global source code 3 Ona blank line in the editor window separate from any other function declare a new variable by typing the dim dimension keyword followed by the name of the variable the keyword as and then the type of the new variable For example the following code declares a new integer variable named count dim count as integer 4 If desired also assign an initial value to the variable by adding a new line containing the keyword init the name of the new variable the operator and the ini tial value of the variable For example the following line initializes the new count variable to a value of 10 init count 10 5 Repeat steps 3 and 4 for as many variables as desired 65 6 Click or select Compile from the File menu to compile the workspace Any errors in the new source code are identified by messages in the Messages and Errors window If no errors are present the compiled workspace is returned to Layout View 9 5 2 Add a Global Function to a Workspace To add a global function to the workspace do the following 1 Select Globals in the Object Tree to access the Global Code space 2 Select Code View The editor window displays any cur rent global source code 3 Ona blank line in the editor window outside of any other function declare a new function by typing the func keyword followed by the nam
21. a preview of the resource is displayed in the Preview box as shown below if appropriate If you selected an audio resource click the button in the Preview box to listen to the sound Edit Bitmaps le EDF Fonts TrueType Fonts Audio Binary Bitmap name Filename Catalog resources catalog bmp default art bmp E ae gr ii resources aterm qi A 8 8 splash resources splashe bmp tank ap resources tankapt bmp Resource data Filename resources gterm a70 bmp Browse Rename gterm_gr 0 E larabief tE OO 00O Resource data Filename larabiet ttf Browse Rename larabieb Mew TrueType fort Remove TrueType font Cancel The Quick Broun Foy The Quick Brown A gt The Quick Bro o The Quick H The Quic The Qui ei Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 OptoTerminal Qlarity Foundry User s Manual 5 2 3 Rename a Resource In the Edit Resources dialog box do the following to change the name of a resource This changes the name that appears in Object Properties for you to select the resource for an object instance it does not change the file name of the resource 1 From the list of resources select the resource that you want to rename and click Rename resource name e g Rename OptoTerminal_g70 A dialog box is displayed with the current name of the resource selected
22. adjustment one for lighter backlight and one for darker backlight one to turn the back light on and one to turn it off Each event e g button press changes the backlight as follows e Backlight Lighter and Backlight Darker adjust the back light one level brighter or darker with each event e Backlight Off turns the backlight off e Backlight On turns the backlight on to the level 1t was at before turning it off Custom Action This option allows you to program a custom action if an available Event Builder action does not meet your require ments Any action supported by the Qlarity programming language may be used Complex actions and events that require the full expressiveness of the Qlarity programming language such as loops and 1f then else logic should be entered in Code View Insert a Blank Line This action 1s not available from the drop down list of actions It appears only 1f the selected event has been previ ously edited in Code View and blank lines were inserted in Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 OptoTerminal Qlarity Foundry User s Manual the event s code This action does nothing It is used to for mat the code generated by Event Builder 8 4 4 Load Event Builder Sample Workspace A sample workspace eventbuilder qly containing events created with Event Builder is included with Qlarity Foundry You may find it helpful to load the sample work space and view
23. an object template Within the Advanced Code section this monitoring is disabled and you can type in advanced code constructs without interfer ence This is only useful for advanced programmers 6 4 Compile Before you download a workspace to the OptoTerminal it must be compiled into the format required for a user appli Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 34 cation Compiling is also required to update modifications made in Code View before they can be seen in Layout View Click the Compile tab to set up the options for compiling Qlanty Foundry Preferences Terminal Layout Editor Compile Simulation Enabled warnings Syntax error Parse error Internal compiler error Undefined reference Redetinition error legal native usage Unresolvable reference legal value Validation function error Override function error of E Limit BOF Fonts to ASCII M chars IM Start in Layout View Enabled Warnings All possible warning messages that may appear when com piling a workspace are listed Click the checkbox to select each warning that you want displayed after a compile When you first start programming in Qlarity Foundry you probably want to display all warnings however if you are an advanced user you may find some of the less serious warnings to be unnecessary An error message is displayed when an error occurs that prevents compiling Error mes
24. as follows Whether the object is displayed on the gt terminal dim enabled as boolean init enabled true func enabled newval as boolean enabled newval Enable me enabled endfunc The comment describes the purpose of the property The dim statement creates a boolean property named enabled The init statement assigns a default value of TRUE to the enabled property which means that 1f the property 1s not assigned an initial value in the object instance the value defaults to TRUE Finally the validation function see section 10 1 Valida tion Functions describes the behavior of the object when Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 74 the value of enabled is changed The validation function first does a strict assignment of the new value to the prop erty then calls the Enable API function to inform the firm ware that the enabled status of the object has changed Calling API functions to implement the effects of a property change 1s a very common activity in validation methods An example of another property found in all versions of the boilerplate code is the parent property as follows Who do we attach to dim parent as objref init parent default func parent newval as objref parent newval Attach me parent endfunc This code creates a property of type objref named par ent Parent is given a def
25. be added to a workspace Each object instance in a workspace must be associated with a template You will create object templates only 1f you are an advanced user Most users create object instances from predefined templates in libraries NOTE library object templates Object templates in libraries are not listed in the Object Tree under the Templates heading Only object templates created in the workspace are listed under the Templates heading 3 8 Layout and Code Views Layout View is the default view mode You will generally use only Layout View unless you are customizing objects or creating your own objects using the Qlarity programming language An example of the work area of a workspace in Layout View is shown below Security View Inside OFF Outside On gt Outside OFF Layout View Code view 72 Simulation Layout View closely simulates how the workspace will appear after it has been compiled and downloaded to the OptoTerminal If you understand the Qlarity programming language you may use Code View to work with an object s programming Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 OptoTerminal Qlarity Foundry User s Manual code Select an object instance and click the Code View tab to display the property initializations for the object instance Object instance code may also contain method overrides which change the behavior of an object instance from that spe
26. box is displayed Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 46 Edit Resources x Bitmaps BOF Fonts TrueType Fonts Audio Binary Bitmap name Filename Alarm resources alarm bmp all resources all bmp bottomLett resources bottomieft bmp bottornright resources bottormrght bmp lightott resources lightott bmp lightorn resources lighton bmp Temp resources temp bmp toplett resources toplett bmp topright resources topright bmp Resource data Preview Filename Ho selection Browse Rename bitmap Mew bitmap Remove bitmap cos EA All resources used in a workspace are managed from this dialog box Select the tab for the resource type you want to manage You can add a new resource rename an existing resource change the file for an existing resource name or remove a resource from the workspace Refer to section 5 2 for information on editing resources 8 1 5 Add Remove Libraries A library is a file that contains predefined object templates that you can use to create user applications Library object templates are programmed to be flexible This means that you can modify them without additional programming to meet most requirements In basic design libraries are your primary source of new objects When you create a new workspace your selections in the New Qlarity Project dialog box determine which libraries are automatically added t
27. chapters 3 through 7 as required to answer specific questions about using Qlarity Foundry Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 CHAPTER 4 WORKSPACES 4 1 Start a New Workspace When you first start Qlarity Foundry the Welcome to Qlar ity Foundry dialog box is displayed To start a new work space from this dialog box click Start New To start a new workspace after Qlarity Foundry is loaded click y on the toolbar or select New Workspace from the File menu The following dialog box is displayed Select the type of workspace to create l x Choose the type of project to create Opto 22 Ethernet 10 or Ultimate 1 0 standard workspace Create workspace like the last one created Opto 22 Ethernet 10 or Ultimate 10 st Descriptions Show Details Back Next gt Finish Cancel The upper box lists several types of workspaces you can create The difference between workspace types is deter mined by the library or libraries included with the selection New options are being added regularly but at the time of this printing the following workspace types were sup ported Opto 22 Ethernet I O or Ultimate I O standard workspace This option includes the Common library and the Program mable Objects library The Common library contains draw ing navigation and communication objects required in all workspaces The Programmable Objects library contains objects
28. con tainer object is attached to the root container by default The root container is not a true object and cannot be disabled Its area cannot be modified The root container is a launching point for newly generated messages This means global message handlers have the highest priority for receiving new messages User Application A user created program that controls the OptoTerminal A user application interacts with the terminal s system soft ware firmware to define and control the terminal s display touch screen speaker and input output actions Validation Method An object method that is implicitly called when the object property of the same name is assigned a value Although the name validation implies that the function is used to validate the value before it is assigned to the property the validation method may be used for any purpose This is a powerful feature of Qlarity because it allows object behavior to be controlled solely by manipulating the object properties Workspace A file created in Qlarity Foundry that contains Qlarity pro gramming code and data for a user application You use Qlarity Foundry to compile the workspace file into a user application and to download the user application to the OptoTerminal You can create any number of workspaces Z Order The order in which objects are layered The order of objects in the Object Tree indicates the Z ordering of objects from front to back The Z ordering ma
29. copy operation E Click to place a cut or copied object in a new location in the same workspace or in a different workspace Click to undo the last action performed The Undo buffer is cleared after the workspace is compiled Click to open the Add Edit Templates dialog box to add or edit an object template Refer to section 5 1 Add Edit Templates and to Chapter 10 Advanced Design for information on creating templates Click to open the Qlarity Resources dialog box to add resources to or remove them from the workspace Refer to section 5 2 Edit Resources for informa tion i Click to open the Libraries dialog box to add libraries to or remove libraries from the workspace Refer to section 5 3 for information 4 Click to turn on off the snap to grid function If enabled this feature forces objects to snap to the nearest grid line when added or moved The top left corner of an object s rectangle snaps to the nearest horizontal and vertical grid lines when you release the mouse button Click to show or hide the grid You can display a grid over the work area to help you more accurately place and align objects For information on changing the spacing or color of the grid refer to section 8 1 3 Drawing Aids gt Click to open the Qlarity Foundry Preferences dialog box to define the terminal s configuration and to enter Qlarity Foundry preferences Qlarity Foundry attemp
30. covers the following information Viewing the Code Understanding Qlarity for Intermediate Design e Qlarity Programming Language e Objects and Templates Qlarity Code for Objects e Property Initializations e Method Overrides Programmable Objects Library e Override an Object Method Global Code e Add a Global Variable to a Workspace e Add a Global Function to a Workspace e Add a Global Event Handler to a Workspace Create a New Object Template 9 1 Viewing the Code To view and change the Qlarity code for an object select the object in Layout View or in the Object Tree and then click the Code View tab at the bottom of the work area see section 3 8 Layout and Code Views In the illustration on the next page the global code for an example work space is shown The Messages and Errors window at the bottom shows any compiling errors that occurred during the last compile Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 62 OptoTerminal Qlarity Foundry User s Manual Ox Qlarity Foundry auto gly Globals Fie Edit View Tools Help T EEEE 24 ASMA Object Tree enum zones as zTopLeft E af ContrastLighter const degree xBoO E af ContrastD arker ya af IsMoisy e oe ai Securely arr oe af Temp w am dim setldx as zones ce j const tmpbif 4 Hip g SetTemp E ai LabelBDF_2 ai CuorsetT emp En af SetNumkeypac ai Setlempl abel const
31. doc umentation as follows doc func CalcFactoral param toCalc The function calculates the factoral of this parameter CalcFactoral calculates the factoral gt of its parameter The factoral of n gt written n is defined as n n 1 re ee o y i func CalcFactoral toCalc as integer gt returns integer endfunc Note that param lines must be completed in one line You cannot use the line continuation character to extend them to more than one line OptoTerminal Qlarity Foundry User s Manual 10 5 Guidelines for Designing New Object Templates This section contains advice and collected wisdom regard ing the design of new Qlarity object templates Designing good object templates is the most complex task in Qlarity programming Once this skill is mastered the full potential of Qlarity can be utilized in your application development Look at template code in the Opto 22 libraries Each library contains the full source code for every object template in the library You are encouraged to study the code in these libraries to learn the techniques and conven tions used in their design Often the easiest way to create a custom object is to modify a template that is similar to the desired object Use the boilerplate code This code provides a complete working Qlarity object ready for customization Do not unnecessarily reinvent the wheel Use a consistent style This is important in any programming
32. endif OptoTerminal Qlarity Foundry User s Manual First note that all of the tool handlers are enclosed inside a if TOOL endif block This excludes the tool handlers when the application is compiled for the OptoTerminal As noted in the comments the MSG_TOOL_ATTACH message is sent to an object when it has been dragged onto a new parent in the Object Tree An objref referencing the new parent is passed to the handler as a parameter In most cases the handler should merely call the Attach API func tion to request attachment to the new parent This is what the boilerplate code does If the object has restrictions on where it can be attached or what types of objects can serve as its parent code should be added to the handler to enforce the restrictions For exam ple the Tabs object in the Opto 22 Common object library can only attach to a Tab Container object The MSG_TOOL_ATTACH handler for the Tabs object enforces this restriction After a requested attach is complete the attached object receives a MSG_TOOL_ATTACHED message from Qlarity Foundry An objref referencing the new parent is passed to the handler as a parameter This provides an opportunity for the object to update its parent property after the attach has been completed successfully The new parent may be different from the parent that was passed to the Attach API function in the MSG_TOOL_ATTACH handler Also note that the boilerplate handler calls
33. examples of the objects events and actions that can be set up using Event Builder To open the sample workspace click Open and go to the folder Qlarity Foundry Samples Eventbuilder demo Select the file eventbuilder qly An image of the workspace 1s shown below RA le Status The functions in the sample application are described in the following sections 8 4 4 1 Tank Demo The Tank Demo controls the level of liquid in a tank with a slider When the position of the slider in the Tank_Slider object changes it triggers the following actions e Transmits its current value out the serial port to a control ler that adds liquid to or drains liquid from a tank to achieve the required level e Changes the text label above the slider to the current value of the slider e Sets the fill level of the gauge In a real life situation the controller to which you transmit the value would start the process to fill or drain the tank and send a value back to 57 the gauge to update it However in the sample simula tion the value 1s sent to the gauge directly e Plays a musical note when the slider is moved 8 4 4 2 Toggle Demo The Toggle Demo toggles a spinner on and off When on a spinner object is displayed that allows a user to increase decrease the value shown The Status_toggle object the button uses the following events TurnOn triggers the following actions e Changes the caption above the toggle butto
34. exception An application may also throw an exception when it detects a problem The Qlarity exception handling system allows the exception handling code to be localized to a convenient OptoTerminal Qlarity Foundry User s Manual location either within an object template or for the applica tion as a whole This section describes the facilities that Qlarity provides for generating and handling exceptions An exception is generated in one of two ways the system software throws an exception if it detects a problem or the application can throw an exception for any reason The application exception is thrown with a call to the Throw API function Each exception carries certain information regarding what occurred and where This information includes an exception level an indicator of severity an exception type a location where the exception occurred and a brief explanation of the error The exception level can assume the following values in order of decreasing severity EXLEV_COMPILER This level indicates a serious error most likely caused by the Qlarity compiler EXLEV_SYSTEM This level indicates a problem in the system software such as memory exhaustion a problem with the message queue and so on EXLEV_IGNORABLE This level indicates an unexpected condition that is gener ally serious but not fatal EXLEV_USER This is the exception level for exceptions thrown by the application via the Throw API function
35. flash file system is simulated but not persistent 1 e it is erased when you leave Simulation mode e The flash memory user data area is not saved when you close Qlarity Foundry OptoTerminal Qlarity Foundry User s Manual 3 10 Object Properties Object Properties displays the properties of the selected object instance Properties LabelBDF_1 Properties Events LabelbDF enabled true default 33 56 7 54 rgb_black col 183 i i fakse default ha_ center a center labelbdt_ 1 sunken true bink falss blinkrate B0 Click an object in the work area or its object name in the Object Tree to display its object properties If Object Prop erties is not displayed pull down the View menu and click Object Properties Object properties are the data in an object instance Exam ples of properties include e Instance name required e Enabled disabled switch e Parent object to which the instance is attached often a form e xy coordinates x and y positions on the terminal display e Color including color of background text border etc selected from drop down lists or the Select Color palette e Font selected from a drop down list e Bitmap image selected from a drop down list e Transparent true false You can edit property values by clicking the property you want to edit Many properties have a drop down list from which to choose a valid entry You ma
36. following dialog box is displayed 25 Download application to unit Download pp download size 24614 Flash required 64 kbytes Download application Download other BFF Upgrade firmware Serial Ethemet Port fealty H Baud rate 115200 Data Format en Send sting over senal connection nt a je Induce Set unit time bootloader Results oe Clear results box Close Window W Open serial port whenever this screen is shown a NOTE settings must match the terminal Your communication settings in Qlarity Foundry must match those at the OptoTerminal For information on refer encing or changing the terminal s communication settings refer to Chapter 7 of the OptoTerminal Hardware User s Manual 7 1 1 Serial Port Settings Click the Serial tab to set up a serial port Serial Ethernet Fort Baud rate 115200 Data Format en Send string over senal connection nt ae Induce Set unit time bootloader Port From the drop down list select the port used to communi cate with the OptoTerminal e g Com1 Baud rate From the drop down list select the baud rate for the port e g 115200 Data Format From the drop down list select the data format for the port e g 8nl 7 1 2 Ethernet Port Settings Click the Ethernet tab to set up an Ethernet port Serial Download via ethernet IF Address of unit 255 255 255 255
37. for the current message is reached Since the message handler was called by the system in response to an event the call cannot be traced further than this function For example suppose a Qlarity statement in function Foo causes an exception Foo is in turn called by a function named Bar Bar is a handler called by the system in response to a message When the exception occurs the Qlarity execution engine first checks the function Foo to see if the offending statement is enclosed within a check error block If it is execution jumps to the first statement in the on error block that follows the check error block If it is not enclosed in a check error block the Qlarity execution engine then checks the Bar function to deter mine if the call to Foo was enclosed in a check error block If it is execution jumps immediately from the offending statement in Foo to the first statement in the corresponding on error block in Bar If no enclosing block is found in Bar the system handles the exception as described below Unhandled exceptions are maintained in a LIFO last in first out stack by the system software If multiple unhandled exceptions are pending a call to GetException always returns the most recently thrown exception on the stack If no enclosing check error block is found an exception remains in the system exception stack until the current mes sage completes processi
38. functions may also be associated with global variables These global validation functions should be included in the Global Code space NOTE strict assignment operator Ordinarily the validation function assigns the new value to the property using the strict assignment operator It is important to use the strict assignment operator when assign ing the new value to the property inside the validation func tion If the validation assignment operator is used the validation function recursively calls itself until the system software stack overflows Refer to section 2 12 3 Validation Methods in the Opto Terminal Programmer s Reference Manual for additional details on validation functions 10 2 The Qlarity API Library The Qlarity API Application Programming Interface is a library of functions built into the Qlarity system software These functions allow Qlarity applications to interact with the Qlarity based hardware to perform tasks such as draw ing on the display or sending data to a communications interface Other functions perform common tasks that would be tedious or difficult to implement using the Qlarity language Over 100 functions are available All functions are documented in Chapter 4 Qlarity API Function Refer ence of the OptoTerminal Programmer s Reference Man ual 10 3 Exception Handling When an abnormal condition arises while a Qlarity applica tion is running the system software generates an
39. hide disabled objects 8 3 Design a User Application This section provides instructions for adding and working with object instances in a workspace to create a user appli cation For information on adding opening and saving a workspace refer to Chapter 4 Workspaces 8 3 1 Add an Object Instance You can add object instances to your workspace from the Object Palette or from the Object Tree shortcut menu as explained in the following sections 8 3 1 1 Add an Object From the Object Palette The Object Palette contains a tab for each library in the workspace as well as an All tab and an Other tab Each tab has icons for all of the object templates in the library Click a tab to select an object from the specified library The All tab contains icons for all objects available to the workspace from all of the libraries in the workspace The background color of each icon identifies the library in which the object can be found The Other tab contains objects from various small libraries Refer to section 3 11 Object Palette for more information on the Object Palette Do the following to add a new object instance from the pal ette 1 Click the icon of the object you want to add 2 Move the mouse pointer to the work area The pointer changes to a cross hair 49 3 Click and hold the mouse button and drag the mouse to draw a rectangle in the work area Then release the mouse button
40. in the text box Olarte Foundry Enter the new name for the resource 2 Type over the name with the new name or edit the name as desired 3 Click OK to rename the resource and close the dialog box The new name appears in the name column of the resource list 5 2 4 Change a Resource File In the Edit Resources dialog box do the following to change the file assigned to an existing resource name 1 From the list of resources select the resource for which you want to change the file 2 Click Browse and an Open dialog box appears 3 Select the file that you want to assign to the resource name 4 Click Open to accept the file and close the dialog box and the file is changed 5 2 5 Remove a Resource In the Edit Resources dialog box do the following to remove a resource from the workspace 25 1 From the list of resources select the resource or resources that you want to remove You can select mul tiple resources as described in the note above 2 Click Remove resource type e g Remove BDF Font The selected resource s is removed from the workspace 5 2 6 Bitmaps Qlarity Foundry supports bitmap images in the standard bmp format Use the following guidelines when creating bitmap images to be displayed on the OptoTerminal Bitmap Size The size of a bitmap image 1s normally shown as the num ber of pixels in width by the number of pixels in height e g 25 x 10 The OptoTermina
41. object to a different location in the Object Tree click and drag it to the desired position The icon for the object is dragged to the new location A horizontal placement line as shown in the illustration below appears as you drag the object to indicate the new position at which the object will be placed when you release the mouse button E of EZR Gages E q EZB ext 3 EXBOFTest_10 A box appears around a container object as you drag another object over 1t If you release the mouse button when the box appears the object you are dragging is placed in the container object al E Rectangle_1 al Pal If you move a parent object a container object with chil dren the children move with it You can place a container object inside another container object Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 OptoTerminal Qlarity Foundry User s Manual To change the Z order of an object within its family with out moving it to a different parent right click on the object either in the Object Tree or in the work area and select one of the following options from the shortcut menu Forward one Move the object forward one position in the Z order one position up the Object Tree Back one Move the object back one position in the Z order one posi tion down the Object Tree Bring to front Move the object to the front of the Z order top of the list of children or top of the Obje
42. on the toolbar or select Edit Resources from the Edit menu and the Edit Resources dialog box is displayed Edit Resources Bitmaps BOF Fonts TrueType Fonts Audio Binary Bitmap name Sys Filename Alarm resources alarm bmp all resources all bmp bottomLeft resources bottomleft bmp bottornriqht resources bottomright bmp lightotf resources ligahtott bmp lightor resourcesrlighton bmp Temp resources temp bmp topleft resources toplett bmp topright resources topright bmp Resource data Preview Filename No selection Erowse Rename bitmap New bitmap Remove bitmap cos 2 All resources used in a workspace are managed from this dialog box Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 24 Click the tab for the resource type you want to manage then follow the procedures in the following sections as applica ble to add a new resource rename an existing resource change the file for an existing resource name or remove a resource from the workspace Additional information on each resource type is also provided in the following sec tions After you have finished adding editing or removing resources click OK to save your changes and exit the Edit Resources dialog box The workspace is compiled Resources that you added are available for use in the objects and resources that you removed are no longer avail able Save the workspace to save the ne
43. project Opto 22 has developed a set of Qlarity programming style conventions for objects that are designed in house This was also used in the boilerplate code The style guide is available on the Qlarity Web site www qlarity com Although you may wish to modify these guidelines or develop your own use of a consistent style will make your object designs easier to develop maintain and use Use consistent naming conventions for properties and methods This is actually part of a consistent style The Opto 22 Qlar ity style guide lists the recommended names for properties that are commonly used in objects Using these conventions aids the designer when the object is used in an application it also increases readability of the object template source code Use validation functions A validation function is the link between an object s proper ties and its behavior Almost every property should have a validation function so that the object can properly respond to property changes Become familiar with the API library All interaction with the Qlarity based hardware is achieved through API function calls You should be familiar with the functions available and their capabilities Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 OptoTerminal Qlarity Foundry User s Manual Provide default values for all properties This provides a predictable starting point for each newly created object instance Provide
44. sages cannot be disabled Limit BDF Fonts to ASCII Characters If this option is enabled only the ASCII characters in BDF fonts are displayed Unless you need to use characters beyond the standard ASCII character set you should enable this option to reduce the memory requirements for BDF fonts OptoTerminals contain 256 ASCII characters Start in Layout View If this option is enabled a workspace is compiled as soon as you load it If you typically work in Layout View you will want this feature enabled If you work more often in Code OptoTerminal Qlarity Foundry User s Manual View or your workspace has errors that haven t been cor rected yet you may want to disable it 6 5 Simulation Use the options in the Simulation tab to adjust or mute the sound during terminal simulation to set up communications for the Communications Comm View window in Simula tion mode to set up the computer s ports to simulate the serial ports on the OptoTerminal and to specify simulated keypad settings for applications that use an external keypad Qlanty Foundry Preferences Terminal Layout Editor Compile Simulation Speaker Volume Communications Window Settings Keypad Settings Use PC network connection to simulate ethernet Seral Port Setup GD Port Num Baud Rate Data Format Flow Control Sim on PC Port com 115200 aN Hone none gt com 115200 aN Hone none gt These settings are the
45. semicolon out the port appendterminator This property determines whether a semicolon is appended to the end of all data sent out the serial port 8 5 2 Ethernet Objects To use the Ethernet port to send data add one or more Ethernet objects If you want to send data to multiple addresses on a network you can create a separate Ethernet object for each address or you can send to different addresses from a single Ethernet object by changing the net work address in the object instance as required Following are the properties of an Ethernet object Name Type a name for the new object type over the default name Each object in the workspace must have a unique Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 OptoTerminal Qlarity Foundry User s Manual name An object name has no size limitation but must start with a letter A name cannot contain spaces but may use the underline character _ The percent pound and dol lar sign symbols can be used at the end of the name enabled If the object is to be enabled select true from the drop down list To disable the object select false parent To make the object the child of a parent object select a container object from the drop down list and the object instance is automatically moved and linked to the selected object in the Object Tree To move an object to the root con tainer select default sendtoport
46. simple to use override functions Many of the objects in the Opto 22 libraries include simple override functions that are called from event handlers Most of these functions are empty by default but they provide a way for each object instance to determine how it will respond to a given event These override functions often take no parameters and have no return value so they are easy to remember and use For example many button type objects have a Click function that is called from the han dler for a touch screen press and release This function is empty by default but it provides an interface for each object instance to customize its response to a press or release event Keep the MSG_DRAW handler small Drawing requires the most computations on the OptoTermi nal The MSG_DRAW handler for an object should be as concise and efficient as possible Where convenient data needed for drawing should be pre calculated and stored in private properties for later use in the MSG_DRAW handler 81 Use user messages to communicate between objects User messages provide an excellent way to communicate between objects because the sending object does not require any knowledge about the receiving object This fea ture allows Qlarity to be extended in a number of powerful ways 10 6 Where to Go From Here The full power and potential of the Qlarity programming language is now at your disposal As your experience with Qlarity grows you will like
47. so that they can properly function in Qlar ity Foundry These methods are described in detail in the next section Other properties and methods can be added to the boilerplate code to implement the desired behavior in the object 10 4 1 2 Area Objects The area object boilerplate code implements a simple rect angular drawable object It also provides the enabled and parent properties as well as the xPos yPos width and height properties to represent the position and size of the object on the display The code for xPos is representa tive of the code for all the new properties as shown below The horizontal position of the object dim xPos as integer INTE POS 0 func xPos newval as integer xPos newVal Relocate me xPos yPos endfunc xPos is an integer with a default value of 0 The validation method assigns the new value to the property as previously described then calls the Relocate API function to inform the system software that the object has moved to a new location on the display This generates a MSG_DRAW mes sage for the appropriate regions of the display The MSG_INIT handler in the area object boilerplate code is similar to its counterpart in the non drawable code as fol lows Perform basic initialization for the object The function will be called once when gt the terminal starts up This function may also be called within gt Ol
48. terminal unless they are disabled they are only hidden in Qlarity Foundry Refer to section 3 7 for information on the show hide option Stop Qlarity Interpreter When a workspace is compiled the Qlarity interpreter runs a portion of the user application in Qlarity Foundry Select this option to stop the user application from running For example if an object instance contains an infinite loop you will not be able to work in Layout View You can select this option to terminate the interpreter and switch to Code View so you can correct the problem NOTE error message The Qlarity interpreter may detect the infinite loop when it tries to run the application and display a prompt for you to stop the application Snap to Grid Select this option to enable or disable the snap to grid function If enabled this feature forces objects to snap to the nearest grid point when added or moved The top left corner of an object s rectangle snaps to the nearest grid point when you release the mouse button View Grid Select this option to show or hide the grid You can dis play a grid over the work area to help you more accurately place and align objects For information on changing the spacing or color of the grid refer to section 8 1 3 Drawing Aids 3 45 Help Menu Show Object Documentation F1 Select this option or press lt F1 gt to view Object Documen tation which is a Help file containing informa
49. up Help is based on the Object Documentation file which you can view by pressing lt F1 gt Tab Location From the drop down list select your preferred location in the window for the Layout View and Code View tabs Layout View Colors The components that appear in the work area layout are listed Click a component to display an example in the Sample box of the color in which it appears in the work area Double click an item to change the color A color selector dialog box appears Click a color in the basic colors section to select it To create a custom color drag the color selector in the rainbow palette to a color and then drag the slider up or down to adjust the saturation and lightness of the color or enter the HSL or RGB of a color Click OK to change the component to the selected color The work area components include the following Out of Display The area that the legend covers not shown if Show Legend Around Display is enabled Display Border The line separating the border and the work area not shown if Show Legend Around Display is enabled Selected Object An object that you click The selected color outlines the object to show that it is selected Hot Object The object under the mouse pointer if Highlight object under the mouse is selected The selected color out lines the object as the pointer moves over it Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO
50. which are referred to as its children In Qlarity Foundry when you add a container object e g tab screen etc to your work area and then place new Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 48 objects inside the container the objects automatically become children of the parent container object If an object is not placed inside a container object it is linked to the root container by default When you collapse the Object Tree you can quickly iden tify all objects in the root container In the following illus tration the first two objects EZBackButton_1 and EZBackButton_2 are area objects that have been placed in the root container The next to EZScreen_3 EZScreen_1 and EZScreen_2 indicate that they are container objects with other objects in them parents with children Object Tree alfa Globals ER gt d Etbherret_0bj gt a backlight down iat ai backlight_up iat ai Contrast down iat ai Contrast_up ES iat ai Ev enable _screenl 25 af SeralCom2 25 af SerialCom DA 2 af MainScreen iat ai Tab_diagnostic E d Tab_E _obj Click next to a parent container object to see its chil dren as shown below Object Tree Ela Globals Rel af Ethernet_obj a ai backlight_down yf backlight_up 2 af Contrast_down ai Contrast_up ee a i Ey enable screen 25 af SeralCom2 25 af SerialCom E la i af MainS creen EE za ai ev disable_scrr 2 a diag_key al
51. 0 2 The Olari APLI diia 70 10 Exception Handle mp as 70 KOA Ercate a New Object Lemplate reina 71 10 4 1 New Template Boilerplate Codec tddi dd 12 LOA lel Non Drawable OD COIS ind ib 74 E Ar TOD A a a a a a E elcdlaceeet eas 74 1043 Container OD ECIS dad 75 10 4 2 Getting New Object Templates to Work in Qlarity Foundry oooocnnnnnnnnnncnnccnonononnnonnnnnnnnnnnnnnnononononononnnnnnnnnnnos 75 104 3 Adding Object Template Documentauon ct adn 79 10 5 Guidelines for Designing New Object Templates oooooccncccccnnnonnnnnnnnnnnnnonnnnnnnnnnnnnnnnnnnnnnnnnnnonnonnnnnn nono nn nano naar nnnnnnnos 80 196 Where to Go From HS id 81 APPENDIX A GLOSSARY OF SOFTWARE TERMS sisscascencdsssasecsiusssecesctsesseecs cea aaa e socecaveubseskedvessecddeasessecdseensedeeees 83 APPENDIX B EZOBTECTS LIBRARY A a aeeoeia 85 Bal Set Upan Event ata ZO By CUS aca a 85 Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 CHAPTER 1 INTRODUCTION 1 1 How to Use This Manual For instructions on installing Qlarity Foundry see Chap ter 2 Installation To get started using Qlarity Foundry and to learn design basics review the following chapters O Chapter 3 Getting Started O Chapter 8 Basic Design To learn more about user application design refer to the fol lowing chapters O Chapter 9 Intermediate Design O Chapter 10 Advanced Design Use the following chapters to le
52. 1s applicable for an object property e g a back ground or text color a Select button appears next to the drop down arrow for the property Click to open the Select Color palette as shown below OptoTerminal Qlarity Foundry User s Manual Select Color TT aa oS Ss Selected shade in color and grayscale Y z The current color of the property is displayed beneath the palette in both color and gray scale as well as appearing in the color palette with a box around it Click a color in the palette to select a different color for the property If you want to match a color from another object in the workspace click a and an image of the workspace is dis played in front of the palette Click in the area of the work space that has the color you want to match The color of the area you clicked is shown in the Sample box In addition the 4X box displays the area magnified four times a Jy ICT Cancel You can click a color in the 4X box to select it This is useful if you want to identify a color in a congested area of the display You can also click in the 4X box and drag the mouse to shift the displayed area slightly Click OK to close the workspace image and the color you selected is shown in the Select Color palette Click OK at the Select Color palette to insert the selected color in the property Opto 22 Fax 800 832 OPTO 6786 Web www opto22
53. 5 2 Understandins Qlarity for Basic Desin tar ii ido 47 8 21 Workspaces and User Applications asia eleanor en 47 A IN A A ener ee ae Tree 47 3 239 Parent Child Relacions sia 4 A LS A II e A dace 48 9 29 Events AMG IVICSSACTINO ral 48 0 20 Enable d Disabled OB CCts di dd tna 49 6 5 Weston a User Appl Cat OM cxsssts5 a E E eanMaeeeaecs 49 Seok ANCE cm OOS ss pce toe ctetv cats adi siete II A A 49 8 3 l 1 Add an Object From the Object Pal tte iii dd 49 8 3 1 2 Add an Object From the Shortcut Menu cceceeseeeseeeeeecceeeececeecensseccnecececcaceecaauecauananseeesaes 49 SA Move Resize and Reorder ODESSA id 50 SI A A outed tvs daly eet A A ealeeiacdetoecetiened 50 Bek RESIZE AM OD id td cca tet Sencar dancers ee eee 50 Saa Change he Onder Ol OBS tra 50 529 Cohan Ge ODE OPONE bio 5I S OO e E E E EE E euacdontaeesaes 52 SA Event Bulderaoiptinan palio 53 tl Overview OF Event Bulder SePS a EE a o rE E ier aliae 53 Sd Event Builder Dialog BOX asrnane ida 53 8 49 elect and Configure ACHONS aissei it ti 54 Skl SelectACUON Solas 54 Zo COMITE ACOSTA a dnctobscesceente 55 9 4 4 Load Event Builder Sample W Orkspace na dida 57 NS A T E E E E N eutacdeseeee noe 57 SAA A AA E RU a tamed beta ee 37 Sado keypad Denda ritos 57 43 Olanty Code and Event Builder ia 57 SLO Troubleshoot Ne soris a e a a 58 5 5 Communication Ob ecards e a E a E T 58 IS O A a a ach ait able seal aa ON 58 SA EEDE C
54. 6786 OptoTerminal Qlarity Foundry User s Manual Object Outlines The outlines around objects if Outline all objects on the toolbar is enabled Grid Grid lines appear in the selected color if Show Grid is enabled Allow Locked Objects to be Moved within Object Tree If an object is locked it cannot be moved in the work area If this function is enabled however a locked object can be moved in the Object Tree 6 3 Editor Click the Editor tab to set up options for Code View The code editor is displayed when Code View is selected and is used to enter and edit objects programming code Qlanty Foundry Preferences E Terminal Layout Editor Compile Simulation sample Text Reset all colors to default Tab Spacing Documentation Errors 4 Show advanced iv global section 6 3 1 Font From the Font drop down list select a font for the text in Code View A sample of the font is shown in the Sample Text box From the Point Size drop down list select a point size for the selected font The Sample Text reflects the selected point size 6 3 2 Colors You can specify a background color or different colors for different parts of the programming code as follows e Background e Normal text e Keywords 33 e Strings e Symbols e Comments Documentation e Errors You can specify that keywords strings symbols comments or errors appear in colors different from norm
55. As dialog box appears see section 4 4 2 4 4 2 Save Workspace As To save a workspace to a different name select Save Work space As from the File menu The following dialog box is displayed Save As E Glarity Foundry z Save In a hvac gly new Workspace gly new workspace gly File name Save as type Clarity files ql Cancel In the File name field type the name that you want to give the workspace you do not have to type the extension Click Save to save the workspace The original file is retained The new file is a copy of the original file If you are renaming the file you will need to delete the original file 4 4 3 Collect for Output Use this option to collect all of the resources used in a workspace into one file You can then move the file to another computer and all resources will be available to open the workspace To transfer a workspace to another computer select Collect for Output from the File menu The following dialog box is displayed 19 Select where to output the workspace 3 Glarity Foundry 2 fe boilerplate ql a of Odema gly a photoshoot gly a programmable example qly a test workspace gly Save IK rogrammable example gly File name Save as type Clarity files gly Cancel In the File name field type the name that you want to give the output file you do not have to type the extension Cli
56. B Templates E glarity dim enabled as boolean init enabled true enabled newral Enable me enabled endtunc dim parent as objret init parent default func parent newral as objref parent nemral Attach ime parent endfunc dim xPos as integer init xPos DO func xPos newral as integer Pos new Val Relocate me xPos yPos The illustration above shows a portion of an example of the boilerplate code provided by Opto 22 as an optional start ing point when creating a new object template The boilerplate code included in a new template depends on the type of object being created 1 e non drawable area object or container The purpose of the boilerplate code is to provide a set of properties and methods found in a typical object of the selected type It also provides fully functional tool methods The source code is well documented and serves as an example of a working Qlarity object Each property is defined as follows descriptive comment describe the property dim statement create the property init statement assign a default value validation method provide functionality for property changes Message Handlers Existing functions func enabled nevvral as boolean Line 1 Col 1 re For example the enabled property is common to all objects and appears in the boilerplate code for any type of template The code that defines the property is
57. EZ obj key a gf MainBackground a a af Tab_diagnostic Ars y DisplayT ab 2 af backlight_downlbl 2 af backlight_uplbl 2 a Contrast_uplbl B ai Contrast_dowmnibl B a Instructions A Lines Ea ai ColorPalette HA gt af Speaker ab sl Line E B y Instructions af HighButton E EE _ Pici o cm OptoTerminal Qlarity Foundry User s Manual A parent object can also be a child a container object with children inside another container object HardwareNew and SoftwareNew in the illustration are examples of par ent objects within other parent objects 8 2 4 Z Order Z order is the order in which objects are layered The Z order determines how objects are displayed whether they are behind or in front of another object or objects and the order in which information is processed messaging In a Qlarity Foundry workspace the Object Tree lists objects in their Z order with those listed first receiving the highest display and messaging priority To change an objects Z order click and drag the object name to a different position in the Object Tree To learn more about how parent child relationships and Z order affect user applications read the next section 8 2 5 Events and Messaging Qlarity is an event driven programming language An event is any type of input such as the following e A keyboard key press or release e A touch screen press or release e A change in a value increment or decrement
58. IP Address of Unit Enter the IP address assigned to the OptoTerminal Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 38 7 2 Download a User Application When you download a workspace to your OptoTerminal it is automatically compiled into binary file format BFF for use as a user application on the terminal The following sections describe how to prepare your Opto Terminal for downloading and how to download the user application 7 2 1 Prepare the Terminal for Downloading You may need to set up the OptoTerminal for downloading using the terminal s Power On Setup utility Refer to Chap ter 7 of the OptoTerminal Hardware User s Manual for information on using Power On Setup 7 2 2 Download the User Application Do the following to download a user application to the ter minal refer to the previous section for information on pre paring the terminal for download 1 Select Download Application from the File menu and the Download dialog box is displayed E Download application to unit Download pp download size 2467 4 Flash required 64 kbytes Download application Download other BFF Upgrade firmware Serial Ethemet Pot Baud rate 115200 Data Format en Send string over serial connection si pe Induce sot ak Uli bootloader Results ee pet Clear results box Close Window J Open serial port whenever this screen is shown y
59. OD Scsi A aca 58 Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 Iv OptoTerminal Qlarity Foundry User s Manual II RECEIVE Dalla ida 59 50 Pest the USSR Ay pp lh Cat he sae ac ce case cette AAA A A RAR 59 S dave and Compile ad WorkSpace ni li 60 SEA A E E r a ar 60 Bind 2s COMPLE A WV OR RSAC E ienn cad 60 So Download a User Appical ON s perrieri o dota bast E a EE 60 CHAPTER 9 INTERMEDIATE DESIGN iii ii didnt 61 A MC Wi MN aos E y a gt APPO AA RE on A O A O II tes 61 9 2 Understanding Olarity for Intermediate Destinia 62 9 21 Olarity Pros raminino Lanus il 62 22D ODs and Templates asa a te stasis dea sa ads seg ta stead pede dete da ete A ccta neonate eee 62 TS ani COGe TOR OD a So ease Fah cas ne Seg O o e ae 63 Ol Property Initial aos iaa 63 12 MENO OVE dE iia tl 63 DA Programmable Objects Libra di dida a 63 94r Overide an Object Method tinta ein 64 A aes we acces ea ec Sak ade Ra cea adel ina taleal ea aae Rew aite ys Oaecakcedaees 65 9 5 1 Add a Global Variable to a Workspace msn di taci n 65 9 5 2 Adda Global Function to a Workspace eii a a a T EN 65 9 5 3 Add a Global Event Handler to a Workspace 0 ccssessesesesseeseessesesssesesscsssseseeceeeeeeeeceeeceeeeeceeeeeeeeeeeeeeeeees 66 9 6 Created New Object Template renn aoe N a a e ee 66 Do Were to GO rO HETE eienen IO PU o In O II 68 CHAPTER 10 ADVANCED DESIGN usina A a dde delia ds 69 IO Validation PUI CIOS 2 tira 69 1
60. OPTOTERMINAL QLARITY FOUNDRY USER S MANUAL REVISION 1 5 OPTO 22 43044 Business Park Drive Temecula CA 92590 3614 USA Phone 800 OPTO 6786 or 951 695 3000 Fax 800 832 OPTO 6786 or 951 695 2712 Email sales O opto22 com www opto22 com Manual 0059 01 Opto 22 form 1344 030604 3205E1 Printed in USA Copyright QSI Corporation 2003 QTERM G70 G70 QTERM G75 G75 QTERM Qlarity and Qlarity Foundry are trademarks of QSI Corporation OptoTerminal is a trademark of Opto 22 Microsoft Windows Windows NT Windows 2000 Windows XP Win32 and their respective logos are registered trademarks of Microsoft Corporation in the United States and other countries The information in this manual has been checked carefully and is believed to be accurate however QSI Corporation and Opto 22 assume no responsibility for possible inaccuracies or omissions Specifications are subject to change without notice Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 FOREWORD Qlarity Foundry is a Microsoft Windows based design tool that uses the Qlarity programming language to help you design user applications for a Qlarity based terminal such as the Opto 22 OptoTerminal Chapter 1 Chapter 2 Chapter 3 Chapter 4 Chapter 5 Chapter 6 Chapter 7 Chapter 8 Chapter 9 Chapter 10 Appendix A Appendix B Introduction This chapter explains how to use this manual to get the most out of Qlarit
61. Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 84 Non Drawable Object An object that has a purpose not directly related to the ter minal display Examples of non drawable objects include communication event and keyboard objects Object The basic unit of a user application You define objects by type with each type representing a display element button or other function Properties and methods define what an object is and how it behaves Object types may take many forms and serve any number of purposes Object types fall into three categories container objects area objects and non drawable objects Object Hierarchy For the display it is the Z order or the order in which objects are layered For messaging it is the order in which objects are prioritized The top object in the object hierar chy receives the highest messaging and display priority 1 e it is on top of other objects However any enabled objects regardless of their position in the hierarchy may receive or send messages You can manipulate the position of an object in the hierarchy with API functions Each con tainer including the root container maintains a list of objects attached to it its children The order of objects on this list indicates the Z ordering of objects from front to back The Z ordering may also be manipulated at runtime using the Z order primitive API functions Object Instance An occurrenc
62. TE some objects are not compatible Some object properties are not compatible If you select an incompatible value for the target property an error is gener ated when you click OK and close the Event Builder dia log box Serial Transmit This action transmits data out one of the terminal s serial ports Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 56 Transmit out Serial Port Select Serial Port COM ad Message to Transmit Sends tank level out COM1 to te your controller Pause until transmission completed From the Select Serial Port drop down list select the communications port on the OptoTerminal from which the data will be sent If you have only one select COM1 In the Message to Transmit box enter the string to send out the serial port or a description of the value to be sent Enable Pause until transmission completed only if you want the terminal to pause Generally you should leave this disabled as it may decrease performance on the terminal Play Note This action sounds a tone on the terminal s speaker Play Mote on Speaker Hote e q E Duration je Select which note to play at the Note field Valid values range from 1 very low pitch to 86 very high pitch The standard beep when a button is pressed is 30 Selecting O generates no sound At the Duration field select the duration of the note in milliseconds The st
63. TO 6786 26 Availability BDF fonts and TrueType fonts are readily available from several sources including many public domain Internet sources TrueType fonts can be used on any Windows com puter Terminal Memory Use A BDF font file is smaller than a TT font file If you are using only one or two sizes of a specific font Arial Times Roman etc you can save terminal memory using BDF fonts If you are using several point sizes for a specific font the TT font will likely use less memory than three or more BDF fonts Display Speed BDF fonts are displayed more quickly than TrueType fonts on the OptoTerminal While the terminal renders TrueType fonts fast enough that the difference in drawing speed is rarely noticeable you might consider using BDF fonts for display items that will change their text frequently such as items that are frequently polled from a remote device Copyright Many fonts are copyrighted Be sure to purchase or obtain permission to use a copyrighted font in your user applica tions 5 2 8 Audio Some terminals from QSI Corporation have an audio codec option that enables them to play waveform audio files If your terminal supports an audio codec you can add audio files in the wav format to your workspace You can play the audio files using the PlaySound API function 5 2 9 Binary Binary resources are files that you want to add to your user application unchanged For example you could use a b
64. Terminal Qlarity Foundry User s Manual lt value gt This is the new value to assign to the property Another common activity is switching screens display pages or hiding one object and displaying another To switch screens the method typically disables the cur rent screen object and enables the screen object for the desired new screen as follows curscreen enabled false newscreen enabled true where curscreen and newscreen are the names of the screen objects to be manipulated Since the override method is a complete Qlarity func tion local variables can be declared and code including conditional statements if else looping for next do while etc and any other legal Qlarity code can be added to the function Complete details on the Qlarity programming language are found in the OptoTerminal Programmer s Reference Manual NOTE return from functions Since Qlarity is an event driven program you should return from functions in a timely manner Writing code that does not return will cause the system to hang 6 Click E Compile button or select Compile from the File menu to compile the workspace If there are com pile errors in your code messages are displayed in the Messages and Errors window An example of such a message is shown below Error in ButtonTTF_21 line 7 Parse error Error in parameter declaration Warning in ButonTTF_1 line 7 Missing statements Function body has no statements Fl
65. _MOVE handler is as follows This function is called when the user gt drags an object instance with the mouse gt in Qlarity Foundry dx and dy are gt relative offsets from the current gt location of the object func ToolMove dx as integer dy as integer handles MSG_TOOL_ MOVE xPos xPos dx yPos yPos dy Relocate me xPos yPos Save the changes we just made Tool Persist xPos Tool Persist yPos endfunc When the user drags an object in Layout View the object dragged receives MSG_TOOL_MOVE messages from Qlarity Foundry The change in position is passed to the handler in the dx and dy values The object updates its xPos and yPos properties to the new location and calls the Relocate API to generate a MSG_DRAW that updates the screen if necessary Finally the handler persists the values of the updated properties with calls to Tool_Persist The code for the MSG TOOL GETHANDLES handler is as follows This function is called by Olarity gt Foundry to obtain the coordinates of the gt resize grips The arrays xCoords gt yCoords and cursors all contain 0 gt elements initially This means that you gt should either call redim on those arrays gt and set their values or declare local gt arrays set the values of the local gt arrays and then assign xCoords yCoords gt and cursors to those local arrays gt
66. a sivas 9 De FAC PM UNE staal tS aaah ass tele A 9 S MUON AI hor cate eact cc ae Beat E A sor eh nets vance O A aan eeeeuts A 10 Soul Layout View LO Da las aaa es o solace aaa dace 10 De De Ole NIC Ws LOOM AR AAA O A O poh 5 E E 10 30 Miscellaneous B d Races an ces aaa locals 1 A Oe Oly Mee E E a a ae etc ge tine a te aa cet coe Man te Resa maaata 11 SeA GODA Seneka eaa a aes crete TE COPECO atc nN enn ere ree mee tere 12 Ded OBEC NMP Ale APA e o E CE PO aasha haste savus tenasdaadanaceescneanaconemdentanttess 12 0 Layout and COGS VIEWS O ada etn cay a cacon a S 12 oe TMM ACL OM PEA e e Po En E E O o A A eee att eee tha coe date aA seeausacaek 13 A SUPPO a eemrmrresmrm termes te a Rene Ut nar E ae ere ae rer 14 5 92 SIMU at Om rie AAN suet asahsead a a a a aa 14 SMO Object Properties in iio locals 14 SEOD CL ee ier APO O A tee a cee ce Men te Rena manaate 15 STA Adda New Object IMS ame alta ap titias a das aa det anes dau lic alias duces 15 de 125 INIOVESANG Resi Ze WINGO WS rin a ea ae EAOa ocadeocaacues esos saases sica 16 345 Where 1060 rom Pere asain at as aise tien io ode uae 16 CHAPTER 4 WORKSPACES A A A ica 17 All GS tarta NEW WORS PICE odio obs 17 A AO tsa WW OLS ACC 24 ois A o do 18 AnD Closca Workspace niunia idas 18 A Saved WOKS Dd Ce prado E a a e 18 AE SIVE W ORS PACE aran a a A 19 AA De Save WOKS pace INS ec A aE 19 dk AA A em a E 19 TSC npea WOS paG oan PRE O E E E O EE E E 19 AO Generne Ae ll y A A gu O uaandss
67. ace is compiled it is converted to a BFF format Container Object An object that contains other objects e g a form or screen On the Qlarity based display a container may represent a portion of the display or all of the display Whether or not a container is displayed depends on its position in the object hierarchy and whether or not containers objects in front of the object are transparent Also the hierarchy determines the order for messaging Enabled and Disabled Objects An object may be enabled or disabled without deleting it from the user application An enabled object can process most messages Disabled objects are not drawn on the dis play and are not eligible to process messages In Qlarity Foundry an object can be enabled or disabled using its object properties but disabled objects continue to be dis played Event An occurrence that signals a change in the terminal state such as a touch screen press a keyboard press a serial char acter receive or a system time tick Events generate mes sages that allow the user application to react to the event in a defined way Globals Code and data that exists independently of objects in an application Libraries Collections of predefined object templates and or resources available in Qlarity Foundry Some libraries are provided by Opto 22 however advanced users may create their own libraries Message Delivers information about an event to the user application Us
68. ackground color to gray It then draws a box using the object s properties to determine the location and size The two calls to DrawLine draw an X inside the box This code is easily modified to provide the desired drawing behavior 10 4 1 3 Container Objects The boilerplate code for a container template is very similar to the code for an area object template The MSG_DRAW handler is slightly different as follows Display the object This function will be called whenever gt necessary to show the object func Draw pass as boolean handles MSG_DRAW 1f not pass then SetFGColor RGB WHITE 75 SetBGColor RGB_GRAY DrawBox xPos yPos xPos width gt 1 yPos height 1 DrawLine xPos yPos xPos width gt 1 yPos height 1 DrawLine xPos yPos height 1 gt xPos width 1 yPos endif endfunc Notice that the MSG_DRAW handler for a container takes a boolean parameter This is because a container receives two opportunities to handle a MSG_DRAW message once before the message is passed to its children and once after the children have finished handling the message The value that the handler receives in the pass parameter indicates whether or not the message has already been passed to the container s children see section 3 3 Draw Messages of the OptoTerminal Programmer s Reference Manual 10 4 2 Getting New Object Templates to Work in Qlarity Foundry Since Qlarity Foundr
69. ad of blanking the terminal display ScreenSaver displays a pattern of danc ing lines for a period of time before it blanks the display By default the display switches to dancing lines after fifteen minutes and to a blank display after thirty minutes You can change the default by selecting ScreenSaver in the Object Tree and changing the value in Object Properties When you are done click Finish to proceed The default workspace name is New Workspace until you save it with a new file name The Object Palette includes tools to create all of the objects contained in the supported libraries NOTE editing resources You can add or remove resources and libraries after the workspace is created using the options on the Edit menu Refer to section 5 2 Edit Resources and section 5 3 Edit Libraries 4 2 Open a Workspace To open a workspace click amp on the toolbar or select Open Workspace from the File menu The following dia log box is displayed OptoTerminal Qlarity Foundry User s Manual Open Look in E Glarity Foundry lex BO Ffonts E Bitmaps libraries J TTfonts 2 hvac qly new Workspace gly File name _ Files of type Clarity files gly Cancel Workspace files have a gly extension All workspace files in the default folder are listed change folders if necessary Click a file to select 1t and 1ts name 1s displayed in the File name field Click Op
70. al text to assist in finding and identifying them within the code Click an item to display its color in the Sample Text box Double click an item or click Set Color to change the color A color selector dialog box appears Click a color in the basic colors section to select it To create a custom color drag the color selector in the rainbow palette to a color and then drag the slider up or down to adjust the saturation and lightness of the color or enter the HSL or RGB of a color Click OK to change the item to the selected color Use Windows Default Color Click an item then click Use Windows Default Color to set the color to the Windows default Reset All Colors to Default Click Reset All Colors to Default to set the color of every item to the Qlarity Foundry default Tab Spacing Enter the number of characters or use the selection arrows to select the number to be indented when you press lt Tab gt Show advanced global section Normally disabled If this option is enabled an Advanced Code section is added to the Object Tree beneath Tem plates in Code View Advanced Code is a special section of global code Normally Qlarity Foundry monitors the code that you type in Code View When you type an advanced code construct such as a declare or define statement Qlar ity Foundry performs the action that you typed e g if you type in a define statement Qlarity Foundry removes the define statement and creates
71. ame gt lt property name gt lt value gt Do not include the angle brackets lt Object name gt The name of the targeted object instance lt property name gt The name of the targeted property must be entered exactly as 1t appears in Object Properties lt value gt The value that you want to insert in the targeted property You can also request that an object s property value be sent back to the external device from a OptoTerminal by sending the object name and property as follows lt object name gt lt property name gt Do not include the angle brackets lt Object name gt The name of the targeted object instance lt property name gt The name of the targeted property must be entered exactly as 1t appears in Object Properties The value of the property followed by a semicolon 1s sent back out the terminal s port to the device making the query NOTE property value requests You cannot request property values for the following properties color bitmap ttfont and bdffont 8 6 Test the User Application You can test most of your application s functionality in Sim ulation mode before you download it to the terminal If the application uses serial communication you may want to Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 60 configure the Simulation mode to use your PC s serial port s to simulate serial communication refer to section 6 5 1 Serial Port Se
72. and Chapter 10 Advanced Design This chapter provides the following information Prepare Qlarity Foundry for Application Design e Basic Design Layout e Simulate the Terminal Display e Drawing Aids Zoom Grid Snap etc e Add Remove Resources e Add Remove Libraries Understanding Qlarity for Basic Design e Workspaces and User Applications e Qlarity Objects e Parent Child Relationships e Z Order e Events and Messaging e Enabled Disabled Objects Design a User Application e Add an Object Instance e Move Resize and Reorder Objects e Change Object Properties Event Builder e Overview of Event Builder Steps e Event Builder Dialog Box e Select and Configure Actions e Load Event Builder Sample Workspace e Qlarity Code and Event Builder e Troubleshooting Communication Objects e Serial Objects e Ethernet Objects e Receive Data Test the User Application Save and Compile a Workspace Download a User Application 8 1 Prepare Qlarity Foundry for Application Design This section provides information on how to set up Qlarity Foundry before you design a user application Begin by opening Qlarity Foundry and starting a new workspace Refer to Chapter 3 Getting Started for information 8 1 1 Basic Design Layout You work only in Layout View to create a basic design You should keep the following Qlarity Foundry windows open as you will use all of them e Toolbar e Object Properties e Object Pa
73. andard button beep lasts 100 ms Refer to the OptoTerminal Programmer s Reference Manual section 4 8 1 PlayNote for more information Set Contrast This action changes the level of contrast on the terminal screen when the event occurs Adjust Contrast f Contrast Lighter Contrast Darker For example you might use this action to provide a contrast adjustment in case the display becomes difficult to read Create two buttons one for lighter contrast and one for darker contrast Each event e g button press changes the contrast one step lighter or darker OptoTerminal Qlarity Foundry User s Manual NOTE contrast level temporary and TFT displays The contrast level set with this action is not permanent When the terminal is reset it reverts to the default contrast level If you want to save the contrast level use a Display Setting object Terminals with TFT displays ignore this command as TFT displays do not support a contrast setting Set Backlight This action brightens darkens turns off or turns on the dis play backlight Adjust Backlight f Backlight Lighter Backlight Darker C Backlight On Backlight Off For example you might use this action to provide a back light adjustment if the terminal is used in low light situa tions or in situations in which the light levels may vary dramatically You may also want to turn the backlight off to extend its life Create two buttons for each
74. arity Foundry whenever a property is gt set in the properties window func StartUp handles MSG_INIT Relocate me xPos yPos Resize me width height Enable me enabled Attach me parent endfunc Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 0P TO 6786 OptoTerminal Qlarity Foundry User s Manual Notice that calls to Relocate and Resize have been added to the handler These properly initialize the location and size of the object on the display Since the area object is drawable a MSG_DRAW handler is required to do the actual drawing The boilerplate version of this method is as follows Display the object This function will be called whenever gt necessary to show the object func Draw handles MSG_DRAW SetFGColor RGB WHITE SetBGColor RGB GRAY DrawBox xPos yPos xPos width 1 gt yPos height 1 DrawLine xPos yPos xPos width gt 1 yPos height 1 DrawLine xPos yPos height 1 gt xPos width 1 yPos endfunc NOTE code formatting A statement is defined as a single line of code In order for the compiler to distinguish between statements each state ment must be separated by a newline character If a state ment must be split into multiple lines type gt at the end of the line to tell the compiler to look for the rest of the state ment on the next line This function sets the foreground color to white and the b
75. arn about specific Qlarity Foundry functions O Chapter 4 Workspaces How to start open close save and use workspaces in Qlarity Foundry O Chapter 5 Templates Resources and Libraries How to add and edit templates advanced function edit resources and edit libraries O Chapter 6 Qlarity Foundry Preferences How to set up and define your terminal settings for Qlarity Foundry and enter Qlarity Foundry preferences O Chapter 7 Download Software to the Terminal How to configure the terminal communications port download user applications and BFF files and upgrade new firmware O Appendix A Glossary of Software Terms A list of Qlarity M terms and their definitions You should read and understand these terms before you attempt to perform the functions described in Chapter 9 and Chapter 10 O Appendix B EZObjects Library The EZObjects library contains object templates that have event functionality programmed into them 1 2 Description Olarity pronounced clarity the programming language used to program an Opto 22 OptoTerminal is a powerful BASIC like language that utilizes the full potential of this family of terminals Qlarity Foundry is a Microsoft Win dows based design tool that uses Qlarity to help you design user applications for these terminals Qlarity uses objects as the building blocks for all user applications An object can take many forms inclu
76. atanaakasaasa lead 19 Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 il OptoTerminal Qlarity Foundry User s Manual CHAPTER 5 TEMPLATES RESOURCES AND LIBRARIES 00 AA Ei 21 Ada Edit Template aia 21 al Add NEw ODect Temple its 21 2 Edito a lacada 22 Rename emplea 22 Sel Remove Template srren ana a E aaenceonteectes 22 Lo Send Templateto LIDE orase e a a a EE 23 J BERESI S ses a dad 23 A SA Us Cs OUI oases anata A aat tnetesgaeilua teiatlicetal lt tacts it 24 Di 2 Zoo Preview RESOURCES ci it 24 CS MM AM At R SO o PAM Po PI a E A ia tdoncataats 25 JA Chance a RESOU eF le meson iaa 25 D2 INC IMO VG OE E iad ahaa cette A a de ae eeeaeas 25 320 A en e E ters 25 A A O II ate alee cela deta 25 A A N 26 Bye o A O E 26 3 Edit LDAN A A A ma et i oa 26 FOL AUE XSS Led OG AL PORRO PPP PP NU A e A II O EA EES 2d HZ Remove Lira ia sai cada 27 Fo EAT IDA e aa 21 Io o A E de cinta ceucennetaaneeee eee 28 SN Rename EN en r OR ee ee mr ee an ne ne ne re 28 O Remove EA dd iodo iaa 28 A SR A O a deheliaee vita euetie 28 KANSAL New A e OU O radish sac wideatacnddea aaa neces seni oeateeea ata 28 A A A e e Eo a II E A 29 HN CTC AUC a Now LIDA aid dia iaa 29 CHAPTER 6 OLARITY FOUNDRY PREFERENCES IN A aia 31 GN andre O E A r eae 31 SE Display SC UU dd ii dt lt cita 31 A o no S 31 A A PO Co O PE SS clatter ee ns AEE ese een eee adored 31 GS Edi da 33 e Ad E ee A E E A T TET
77. ault value of default which is the root container when assigned to objref variables The validation method assigns the new value to the property using the strict assignment operator then calls the Attach API function to attach the object to its new parent container 10 4 1 1 Non Drawable Objects The boilerplate code for a non drawable object template includes the enabled and parent properties It also includes a handler method that handles the MSG_INIT message The code is as follows Perform basic initialization for the object The function will be called once when gt the terminal starts up This function may also be called within gt Olarity Foundry whenever a property is gt set in the properties window func StartUp handles MSG_INIT Enable me enabled Attach me parent endfunc The comments describe what the handler is and when it is called The method is called StartUp takes no parameters and has no return value It is declared as a handler for the MSG_INIT message The body of the method merely calls the Enable and Attach API functions passing the values of the enabled and parent properties This is necessary to properly ini OptoTerminal Qlarity Foundry User s Manual tialize the objects by informing the system software about the state of the object at system startup All versions of the boilerplate code include a set of tool message handlers
78. b Cancel 2 Enter a file name for the new library e g mylib and click Save The extension ib is added automati cally Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 30 OptoTerminal Qlarity Foundry User s Manual The following dialog box is displayed The new library file is created and added to the Qlarity Foundry folder Use the Edit Library function to add entries object templates and resources to the library see section 5 3 3 5 Add New Entry for information Enter a name for the library You can also add new object templates to a library using the Send Template to Library option in Add Edit Templates see section 5 1 5 for information 3 Enter a descriptive name for the library e g arch library or Johns library and click OK Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 CHAPTER 6 QLARITY FOUNDRY PREFERENCES Use the Settings option to record the display configuration of your OptoTerminal and to enter Qlarity Foundry prefer ences Qlarity Foundry requires this information to simulate as accurately as possible the terminal display The Settings option is also used to set up options for the code editor Code View and to enable or disable warnings and other defaults for compiling Click gt on the toolbar or select Settings from the View menu and the Qlarity Foundry Preferences dialog box is displa
79. but ton To move a window click the title bar hold down the mouse button and drag the window to another location either in the main window or outside the main window As you drag it you will see an outline that indicates the posi tion and size it will be When it is in the position you want release the mouse button If you release the mouse button OptoTerminal Qlarity Foundry User s Manual close to a docked position in the main window the win dow snaps into place NOTE floating windows If you do not want the window to snap into a docked posi tion hold down the lt Ctrl gt key as you drag it It then becomes a floating window that can be positioned anywhere on the screen To resize a window move the mouse pointer over any side or corner until the pointer changes to directional arrows Click and hold the mouse button and drag the side or corner of the window until it 1s the size you want then release the mouse button NOTE resize the main window You can resize the main window using the same method To close a window click To open a closed window select its name from the View menu 3 13 Where to Go From Here When you have finished reviewing Getting Started refer to Chapter 8 Basic Design to learn about the Qlarity design process and specifically to section 8 4 Event Builder for information on Qlarity Foundry s user friendly design tool for creating user applications Refer to
80. cal override functions to many instances of the same object consider modifying the object template to create a new template with the desired functionality 9 4 Programmable Objects Library The Programmable Objects library progobjs lib contains object templates that are similar to the templates in the EZObjects library However these objects are intended to handle events through method overrides rather than through event property settings Almost every Programmable Object has one or more methods that can be overridden in object instances to provide specific object behavior For example many button like objects such as the Button BDF or LabelBDF objects publish a function called ClickQ By default this function does nothing but each instance of this object can include an override of the Click function to take some action in response to a press event on the object A typical response might include sending some characters to a communications port switching to a differ ent screen or modifying the contents of another object In this manner an object s response to events is pro grammed using the Qlarity programming language Once you are familiar with the basics of Qlarity programming it Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 64 is easy to program complex event handling into objects without the need to manage numerous event properties 9 4 1 Override an Object Method T
81. cified in the object template The following example shows the code for a text object in the sample workspace shown in the Layout View illustra tion above parent width height caption Currently set to font helwl4 transparent true fgcolor gt rob white The following example shows the first portion of the pro gramming code for the Temperature Update template dim enabled as boolean init enabled true func enabled newval as boolean enabled newval enable me enabled endfunc dim parent as objref func parent newval as objref parent neral attach me parent endfunoc current temperature values dim ctemp 4 as float init ctemp F1 71 Fl 71 func ctemp nevrral as float ctemp i newral updatecurtemp i endfunoc func ctemp newval as float index as integer ctemp index newval 3 9 Simulation Simulation mode is used to simulate with some limitations the operation of a user application after it is downloaded to the terminal Both touch screen and keyboard actions are simulated On a simulated touch screen for example you can activate a button by clicking it with the mouse When you click it the programmed action occurs In the following 13 illustrations the mouse pointer a hand is positioned over the activated button Lighting wiew HVA View security 4 Y HVA View Lighting All zones are at optimal temperatur
82. ck Save to save the file 4 5 Compile a Workspace Click on the toolbar or select Compile Workspace from the File menu to compile the current workspace into the format required for a user application Compiling is also required to update modifications made in Code View before they can be seen in Layout View However if you make changes in Code View and then switch to Layout View the program compiles automatically If the compile is successful the program displays the appli cation in Layout View If any errors occur during the com pile the program switches to Code View and the error messages are displayed in the Compile dialog box 4 6 Generate a BFF File Use this function to save a Qlarity workspace file to binary file format BFF which is the application format required by the terminal When you use the Download Application option to down load the current workspace to the terminal Qlarity Foundry automatically compiles the workspace into a BFF file how ever the BFF file is not saved To save a workspace s BFF file so that you can download it at any time without loading the workspace in Qlarity Foundry do the following 1 Load the workspace that you want to save to a BFF file Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 20 2 Select Generate filename bff from the File menu where filename is the name of the current work space The following dialog box is d
83. com Phone 800 321 O0PTO 6786 OptoTerminal Qlarity Foundry User s Manual 4 Event Builder Qlarity is an event driven programming language An event is any type of input such as a key or button press a value change a timer action data received through the serial port and so on When an event occurs a Qlarity user application responds with an action Event Builder is a tool in Qlarity Foundry to help you add events to your Qlarity user applications Event Builder allows you to assign actions to events without any program ming knowledge Using the options in the Event Builder dialog box you can link one or more actions to an event even when the action involves several objects or includes one or more serial objects You assign an action to an object and its properties from drop down lists The type of object you select determines the type of event or events that can be performed by the object For example a button will have a click event and a serial object will have data receive and send data events Keep this in mind when you are adding objects to your workspace The Object Documentation Help file lt F1 gt provides informa tion about all object templates in the Opto 22 libraries including events and actions that can be performed by the object type 8 4 1 Overview of Event Builder Steps To design a user application using Event Builder you will generally take the following steps e Decide what yo
84. ct it remains selected and its object properties are displayed You can then edit the properties as required including assigning the object a unique name To resize an object do one of the following e Use the mouse If the object has resize grips sizing handles you can click and drag any handle to resize the object Resize Grips e Use Object Properties Change the height and or width integer in Object Properties Select from the drop down list or type in the new value To move an object do one of the following e Click in the center of the object hold down the mouse button and drag the object to a different position You can hold down the lt Shift gt key while moving an object to limit its movement to horizontal vertical or a 45 angle Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 16 e Change the x and or y position integer in Object Proper ties Select from the drop down list or type in the new value 3 12 Move and Resize Windows The following windows can be moved resized or undocked separated from the main window e Object Tree e Object Properties Layout View e Object Palette Layout View e Messages and Errors e Miscellaneous bar e Communications wndow Simulation mode e Keyboard Simulation mode e Key Pad Simulation mode Each window has its own title bar at the top the Miscella neous bar has a title bar on the left side under the Close
85. ct Tree Send to back Move the object to the back of the Z order bottom of the list of children or bottom of the Object Tree 8 3 3 Change Object Properties Each object has properties that help define the object instance Click an object in the work area or click an object name in the Object Tree to display Object Properties If Object Properties is not displayed pull down the View menu and click Object Properties The default properties for an object instance are defined in the object template from which the object instance was added You can change any of the default properties for an object instance to create a unique object that meets your requirements Properties that are common to almost all objects include e Object name e Enable disabled status e Parent specification A wide range of additional properties vary depending on the type of object For example some typical properties for area objects include e Size height and width e Alignment xalign and yalign 51 e Color for borders fill foreground background font etc e Font for a text area object e Position in display xpos and ypos where both posi tions start at the top left corner of the parent object The xpos value increases right ypos increases down For specific information about any Opto 22 library object open Object Documentation lt F1 gt The following illustration s
86. ction 7 2 2 Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 CHAPTER 9 INTERMEDIATE DESIGN Chapter 8 Basic Design introduces some basic applica tion design techniques using Qlarity Foundry It also pro vides information on Qlarity Foundry s Event Builder which can be used to add events to your applications with no programming While this is enough for many applica tions if you require very complex flexible or custom appli cations you will want to have some Qlarity programming skills To assist you with intermediate design and help you get started with Qlarity Programming this chapter provides information on the Programmable Objects library progobjs lib provided with Qlarity Foundry With these objects you use method overrides to manipulate the object templates This chapter also discusses adding global code and how to create new object templates based on tem plates that already exist in libraries By applying a small amount of programming you can add a great deal of flexi bility and power to your applications Before proceeding you should be familiar with the con cepts presented in Chapter 8 Basic Design Also this chapter includes many references to the OptoTerminal Pro grammer s Reference Manual This manual provides an invaluable resource as you learn intermediate Qlarity design and eventually advanced Qlarity design as explained in Chapter 10 This chapter
87. d enable Snap to Grid click gt on the toolbar or select Settings from the View menu Click the Layout tab and edit the follow settings as needed refer to section 6 2 for more information e Show Grid show hide grid e Snap to Grid enable disable snap to grid e Grid Spacing set the spacing of the grid lines e Colors Grid set the color of the grid lines 8 1 4 Add Remove Resources Resources include all bitmap images fonts audio files and binary data files available in a workspace and eventually in the user application You must add resources to a workspace before you can use them in object instances Use the Edit Resources option to add resources to your workspace or to change or remove the resources used Because resources become part of the user application when it is compiled you should delete any unnecessary resources NOTE default bitmaps and fonts When you create a new workspace you have the option to add default bitmap images and fonts to your workspace Some objects may require at least one bitmap BDF font or TT font resource before the object will function properly When you have finished creating a workspace however you may want to remove any unused default bitmaps and fonts before you download the user application to the Opto Terminal to conserve the terminal s flash and RAM mem Ory Click amp on the toolbar or select Edit Resources from the Edit menu and the Edit Resources dialog
88. d how to configure them 8 4 3 2 Configure Actions The action drop down list contains the following actions e Enable Disable Object e Set Property e Serial Transmit e Play Note e Set Contrast e Set Backlight e Custom Action After you select an action options appear in the action con figuration area of the Event Builder dialog box to configure the action Refer to the following sections for information on each action s configuration Enable Disable Object This action enables or disables the selected object When an object is disabled it is not shown on the terminal display and will not respond to most events In the following action example when the event occurs a spinner object is dis abled To enable the spinner object a second event and action are required Enable Disable Object Enable this object 0 Disable this object Toggle this object s enabled state A common use of this type of action 1s to change screens in response to a button press For example in the click event of a ButtonBDF object there might be two object enable dis able actions one to disable the currently displayed screen and another to enable the next screen Set Property This action sets the value of an object property or global variable You can use Set Property for example to change the value of a property in another object The property to set 1s the action that results from the event 55 Set to this Value
89. d warning you that this will permanently remove the entry from the library Click Yes to remove the entry 5 3 3 4 Set Entry Version Click an entry in the list to select it then click Set Entry Version to change the version number of the selected entry A dialog box is displayed for you to type the new number Click OK to apply the change and close the dialog box 5 3 3 5 Add New Entry A library contains two types of entries e Source objects object templates e Embedded resources e g bitmaps BDF fonts and TT fonts Only resources that are used in an object template e g a custom button tab etc need to be embedded in the library Libraries can also reference any resource that has been loaded into a workspace However by embed ding the resource in the library you make certain that it is available when an object instance is created To add a new entry to a library click Add New Entry The following dialog box is displayed Mew Library Entry Ea Entry name Entry type Bilmap Filename Browse cos Entry Name Enter a name for the new entry A name has no size limita tion but must start with a letter or underline character _ A name cannot contain spaces but may contain the underline Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 OptoTerminal Qlarity Foundry User s Manual character The percent pound and dollar sign symbols can be used at
90. ding text labels and fields bitmaps lines forms key definitions clocks counters and so on Libraries which are supplied with Qlarity Foundry contain predefined objects for which the programming is already done To adapt a library object to a user application you typically only need to enter properties e g name location color bitmap etc If custom programming is required Qlarity Foundry contains the tools you need to modify library objects or create your own objects Qlarity Foundry provides all the tools you need to work with user applications including those used to do the fol lowing e Create a user application basic to advanced levels e Modify a user application e Compile and download a user application to the terminal Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 OptoTerminal Qlarity Foundry User s Manual Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 CHAPTER 2 INSTALLATION This chapter provides instructions for installing and setting up the Qlarity Foundry software 2 1 System Requirements Computer Requirements e Pentium 166 or better e 32 Mbytes of RAM 64 Mbytes recommended e 30 Mbytes available hard disk space Operating System Requirements Microsoft Windows 95 98 2000 NT 4 0 or later or XP Qlarity Foundry will not run in Windows 3 x or DOS Windows 95 requires Internet Explorer 4 01 or higher Win dows
91. dit Natives button to view the utility functions included in the Natives library Edit Library Path Ic program fles gsi corporation glanty foundry natives lib Name Standard Icon Foreground Icon Background G Versions on Warming Any changes you make to libraries may affect other projects Additionally any changes will take effect imnedediately and cannot be undone Edit Entry Absolute alues Source 1 01 SOWICe 1 01 Rename Entry Source 1 01 Remove Entry Draw3DRect Source 1 00 IPSubpoort Source 0 00 Notes Source 1 00 Set Ent Version Skingra Source 1 00 Test lionment Source 1 00 TextConstants Source 1 00 Add New Entry TexthultilineB DF Source 1 02 Texthultiline TTF Source 1 02 TextS ingleLine BOF Source 1 01 TestSingleLineBDF Eey Source 1 01 Text5imolelineT TF Source 1 01 TextSingleLineT TF Rey Source 1 01 Do not modify these functions as objects in various librar ies also use them In addition any changes you make to Natives library functions are overwritten when you upgrade Qlarity Foundry Refer to section 5 3 3 Edit Library for information on editing functions 5 3 5 Create a New Library Do the following to create a new Qlarity Foundry library 1 Click Create New Library A dialog box similar to the one shown below is displayed Create a new library 3 Glarity Foundry Fz Save In Al common lib File name CS Save as type Library files I
92. e NOTE required settings for simulation To effectively simulate the OptoTerminal you need to define the terminal s hardware in Qlarity Foundry including whether you use a touch screen or keyboard Use the Set tings option to define the terminal s hardware and to set the simulation s volume and display functions Refer to Chapter 6 Qlarity Foundry Preferences for information Opto 22 Fax 800 832 0PTO 6786 Web www opto22 com Phone 800 321 OPTO 6786 14 3 9 1 Serial I O Support Simulation mode partially supports serial I O using the Comm View window in the bottom left corner of the dis play Comm view mit ES Com Com2 Serial data programmed to be transmitted through the termi nal s Com1 or Com port appears in the lower portion of the Comm View window You can also enter data in the upper portion of the window and click Xmit to simulate data being sent to the terminal Click Config to access the Communications Window settings see section 6 5 2 for information 3 9 2 Simulation Limitations The Simulation mode has the following limitations e When using a keyboard the repeat delay rate 1s determined by your global setting in Windows This will only match your terminal s settings if you set it to match on your PC PrintScreen and Pause Break keys cannot be properly simulated e SystemSettings and related API functions may not be fully simulated e The
93. e A timer action e Data received through the serial port When an event occurs a Qlarity user application responds with all appropriate and specified actions The system generates a message indicating that the event has occurred and what it is The terminal s message han dling system determines which object or objects get the message and in what order the messages are processed The message is first passed to the root container which passes the message to each of its children beginning with the front most object highest Z order When the message is passed to a container object this object first handles the message then passes it to each of its children beginning with the front most object in the container The terminal pro cesses the message to completion Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 OptoTerminal Qlarity Foundry User s Manual 8 2 6 Enabled Disabled Objects An object instance can be enabled or disabled On the Opto Terminal only enabled objects are displayed Disabled objects still reside in the user application but they cannot receive or send most messages nor are they displayed on the terminal If a container object is disabled it cannot pass messages to its children In Qlarity Foundry all objects are displayed in the work area by default whether they are enabled or disabled However you can select the View Only Enabled Objects option on the Tools menu to
94. e in Glarity Foundry Create a completely blank template Create a template based on a pre existing library object Template name Area Object Cancel Object type 3 Select one of the following Create a template ready to operate in QF This option inserts the new template boilerplate code into your workspace see section 10 4 1 New Tem plate Boilerplate Code Create a completely blank template This option starts a blank template You will need to add all Qlarity code 4 Type a name for the new template in the Template Name edit box OptoTerminal Qlarity Foundry User s Manual 5 Select the type of object non drawable area object or container from the Object Type list box 6 Click OK The new template name appears in the Add Edit Templates dialog box 7 Click Close to close the Add Edit Templates dialog box 8 Select Code View The new template name appears under the Templates icon in the Object Tree Templates are not shown in the Object Tree in Layout View 9 Click on the new template in the Object Tree If you created a template ready to operate in QF the boiler plate code appears in the edit window 10 Variables declared inside a template become properties of the template object and functions declared inside the template become the object s methods Add delete or modify properties and methods as desired 11 When you are finished defining
95. e in the workspace must have a unique name A template name has no size limitation but must start with a letter or underline character _ A name cannot contain spaces but may contain the under line character or pound sign The percent and dollar sign symbols can be used at the end of the name 6 Click OK to create the new template Many library templates depend on global code or other resources in the library Qlarity Foundry will add these items to your workspace and inform you of the addi tional changes in a dialog box When the dialog box appears click OK to proceed 7 The template list in the Add Edit Templates dialog should now include the new template Click Close to close the dialog box Now do the following to edit the new template to your spec ifications Select Code View The new template is now listed under the Templates heading in the Object Tree 2 Select the new template in the Object Tree The source code for the template is displayed in the editor window 3 Edit the template source code Variables declared inside a template become properties of the template object and functions declared inside the template become the object s methods Properties and methods can be added deleted or modified as desired You can add properties and methods just as described for the Global Code space see section 9 5 4 When you are finished editing the template click E or select Compile from the File
96. e of an object in a user application An object instance is defined by the object template on which the object is based Each object maintains its own properties and may contain code for method overrides Object Template The programming code that defines an object Each object instance in a user application is based on a template Object templates can be a part of a workspace or supplied through one or more libraries The template defines which proper ties and methods are included in the object Properties Variables that are stored in an object and comprise the data portion of the object The properties for each type of object are defined in the object template but each object instance maintains its own properties In Qlarity Foundry object properties can be changed in Object Properties in Layout View without the need to modify the programming code Properties may also be changed at runtime to reflect the cur rent state of the object OptoTerminal Qlarity Foundry User s Manual Qlarity A BASIC like scripting language that is used to write user applications for the OptoTerminal Resources Bitmap images fonts audio files and binary data files available for use 1n an application Root Container A root level container that uses the global properties and methods as its properties and methods The root container is best viewed as an abstraction It gives you a place to attach all other objects An object that is not attached to a
97. e of the function a left parenthesis the parameters of the new function and a right parenthesis If the function returns a vari able the right parenthesis should be followed by the keyword returns then the type of the returned value The end of the new function is indicated by the end func keyword on its own line The parameters appear as new variable declarations see section 9 5 1 without the dim keyword Each parameter is separated from other parameters by a comma For example the following code declares a new func tion named average that takes two floats named first and second as parameters and returns a float func average first as float second as gt float returns float endfunc NOTE code formatting A statement is defined as a single line of code In order for the compiler to distinguish between statements each state ment must be separated by a newline character If a state ment must be split into multiple lines type gt at the end of the line to tell the compiler to look for the rest of the state ment on the next line 4 Fill the body of the function between the func state ment and the endfunc statement with the Qlarity code to implement the desired function If the function returns a value be sure to include a return statement followed by an expression that yields the value being returned For more information see the OptoTerminal Programmer s Reference Ma
98. e typed or displayed Resources bitmaps and fonts are required for text and bit map objects Container object An area object that contains other objects such as the Screen object in the common lib library A container object may occupy part of the terminal display or the full display area You use container objects to define an association between objects and to indicate how they are displayed All objects in a container process information as a group Con tainers are often stacked and identified with tabs 8 2 3 Parent Child Relationships Qlarity allows you to group objects together How objects are grouped determines how information is processed mes saging and how the terminal screen redraws The complex ity of your user application determines how much you need to group objects Grouped objects have a parent child relationship with the parent always a container object and the objects inside the container the children Each user application starts with a root container Though invisible it is the container in which you place all other objects The following illustration shows a root container with several objects in it Root Container Container Object Container Object Object Object Object Object Object Object linked to Root Container In this illustration two container objects plus another object are linked to the root container In addition each container object has objects linked to it
99. e workspace is compiled or during a debug operation These messages can help you identify and correct problems with the workspace Object Tree Select this option to show or hide the Object Tree Object Palette Layout View only Select this option to show or hide the Object Palette Object Properties Layout View only Select this option to show or hide Object Properties Refresh Layout View only Select this option to redraw the graphics on the screen in Layout View Layout View Select this option to switch to the Layout View Code View Select this option to switch to the Code View Simulation Select this option to switch to the Simulation mode Settings Use this option to open the Qlarity Foundry Preferences dia log box to define the configuration of the OptoTerminal and to enter Qlarity Foundry preferences Qlarity Foundry attempts to simulate the terminal s display area input type and so on as closely as possible Refer to Chapter 6 Qlar ity Foundry Preferences for information 3 4 4 Tools Menu Layout View only View Only Enabled Objects Disabled objects are displayed in Layout View by default Select this option if you want to see only enabled objects in the work area NOTE disabled objects vs hidden objects Keep in mind that the enable disable option is different from the show hide option Disabled objects are not dis played on the terminal hidden objects are displayed on the
100. ect Actions To select actions for an object s events do the following 1 In the open workspace e g eventbuilder qly select the object for which you want to set up an event e g Tank_slider 2 In Object Properties click the Events tab All events associated with the object are shown For example the Tank_slider object in eventbuilder qly has one event Change 3 Click El next to the event to open the Event Builder dialog box The action table lists all actions that have been configured for the event MET AAA Serial Transmit Transmit Sends tank level out COM1 to your controller out COM1 2 Set Property Set Slider_label s caption property to Str T ank_slider value Set Property Set Tank_gauge s value property to Tank_slider value Play note 43 for 12 ms The last line of the action table always contains a drop down list that you use to add a new action to the event 4 Click anywhere on the line to open the drop down list and select an action The action and its description are added to the table If you want to add a new action in the middle of the table or remove an action from the table right click in the action line A shortcut menu is displayed with options to insert or remove actions Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 OptoTerminal Qlarity Foundry User s Manual 5 Refer to the next section for information on each type of action an
101. ect any addition options for your application then press Finish Back tet gt Finish Cancel This dialog box allows you to add or remove resources Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 18 Include a default font and bitmap Before some objects can be added to a workspace at least one font or bitmap image must already exist in the work space if not an error occurs For this reason it is recom mended that you include the default fonts and bitmaps Include extra BDF raster fonts To include additional fonts in your workspace select this option Include an error handling object By default an error handling object ExceptionDisplay is added to your workspace that identifies and displays descriptions of any errors in your code It is recommended that you include this object in all of your workspaces Include a screen blanker By default a ScreenBlanker object is added to your work space that blanks the terminal s display after a period of time to save power and reduce wear on the backlight tube By default the display blanks after fifteen minutes but you can change the default by selecting ScreenBlanker in the Object Tree and changing the value in Object Properties If you don t want the display to blank don t select this option Include a screen saver You can use a ScreenSaver object in the place of a Screen Blanker object by selecting this option Inste
102. ection 7 4 1 below for information on identi fying the version of your current terminal firmware Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 OptoTerminal Qlarity Foundry User s Manual e Refer to section 7 4 2 for information on preparing your terminal for downloading firmware e Refer to section 7 4 3 for information on downloading the new firmware 7 4 1 Determine Current Firmware Version If you are not sure what version of firmware is on the Opto Terminal do the following to determine the current version of terminal firmware 1 Verify that the OptoTerminal is connected to your com puter 2 Put the OptoTerminal in Develop mode App Mode Develop Refer to Chapter 7 of the OptoTerminal Hardware User s Manual for instructions 3 Select Download Application from the File menu 4 Power the terminal on If it is already on power it off and back on The firmware version and date of issue are displayed in the Results box as shown in the figure below E Download application to unit Download pp download size 4607 Flash required 64 kbytes Serial Ethemet Pert com Baud rate 115200 Data Format en Send string over serial connection si e Induce Set unit time a Engineering ethernet address detected Development mode Firmware version 1 570 c 1 016 BFF Built Mar 19 2003 at 13 38 12 Download application
103. ed into them However with EZObjects you are lim ited to the objects in the library Note that EZObjects cannot be configured in Event Builder Refer to Appendix B EZObjects Library for more information Edit in Code View Click Edit in Code View to view the event s actions as programming code If you understand the Qlarity program ming language you may use Code View to work with pro gramming code You will generally only work in Code View if you are customizing actions or creating your own actions If you are learning Qlarity programming it may also be helpful to view the code to understand how an event is programmed OptoTerminal Qlarity Foundry User s Manual Descriptions Code Preview Click Descriptions to display the Qlarity programming code for the actions in the Description column of the action table The button label changes to Code Preview Click Code Preview to switch back to a description of each action in the table 8 4 3 Select and Configure Actions A sample workspace eventbuilder qly containing events created using Event Builder is included with Qlarity Foundry For information on loading and using the sample workspace refer to section 8 4 4 Load Event Builder Sample Workspace The sample workspace is used in the images and examples in this section You may find it helpful to load the sample workspace and use it to view examples of the actions described in this section 8 4 3 1 Sel
104. ehreld lt Back Cancel 7 Click each type of system setup to read a description of the files that are installed Then select the type of setup that best suits your needs Complete Custom Mini mal or Typical Click Next to continue If you OptoTerminal Qlarity Foundry User s Manual selected Custom a dialog box appears for you to select the files and features you want to install The Setup Status window appears and displays the sta tus of the installation as each file is installed in the specified destination folder InstallShield Wizard Setup Status Glarty Foundry 1 51 Setup is performing the requested operations C Program Files4 Q51 Corporation Alarte Foundry smnodbus lib 43 Inetallahreld After all of the files are copied to your hard disk the following window appears InstallShield Wizard InstallShield Wizard Complete Setup has finished installing Qlarity Foundry 1 51 on your computer 8 Click Finish Installation is complete Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 CHAPTER 3 GETTING STARTED 3 1 Start Qlarity Foundry To start Qlarity Foundry click Start then click Programs and select Opto 22 Software Click Qlarity Foundry to start the program 3 2 Open a Workspace A workspace is a file created in Qlarity Foundry that you will compile into a user application In Qlarity Foundry you use a workspace to de
105. elect Object Documentation on the Help menu to open Object Documentation To add documentation on global variables global functions objects methods or properties that you create you must add the proper doc code to your code AutoDoc will then find the information you enter and add it to the Object Doc umentation Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 80 To document a program item type the following in the same location as the item e g to document an object property enter the documentation within the object This documents an object property OR gt global variable doc property lt name gt doc prop lt name gt This documents a global function or gt object method doc func lt name gt doc function lt name gt doc override lt name gt only use this gt if the function is designed to be gt overridden This documents an object itself doc object lt name gt To enter a description of an item begin each line of the description with a tilde doc object buttonBDF The ButtonBDF object is a versatile gt object that responds to touchscreen gt input When you touch an instance of the gt ButtonBDF object the function called gt Click is called The tilde must be the first non whitespace character on the line otherwise it is treated as a comment When documenting a function you can add parameter
106. elect this option to make the work area grid visible Snap to Grid Select this option to force objects to snap to the nearest grid line when added or moved This is useful for more accurate placement and alignment of objects Preview while dragging only available in Windows 2000 or Windows XP This option controls the way objects appear while dragging them with the mouse to move them in Layout View If selected a preview of the object in the new location is displayed If not selected an outline of the object is displayed Time the mouse must be held This setting determines how long the redraw function is delayed when dragging an object For most systems the default should be optimum If you need to increase or decrease the time interval enter a value in milliseconds OptoTerminal Qlarity Foundry User s Manual Highlight object under the mouse If this option is enabled each object s outline is highlighted as you move the mouse pointer over it If disabled an object s outline only appears when you click it Show data types in properties window If this option is enabled the data type of each property integer color string boolean bdf font etc is shown in Object Properties Show pop up help for objects and properties If this option is enabled a Help pop up appears when you move the mouse pointer over icons in the Object Palette and when you click on properties in Object Properties The text for the pop
107. emove an object template from the workspace 1 Click the template that you want to remove It is high lighted in blue 2 Click Remove Template 3 A prompt is displayed to confirm that you want to remove the template Select Yes to remove the object template from the workspace Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 OptoTerminal Qlarity Foundry User s Manual 5 1 5 Send Template to Library After you have created and customized an object template you can add it to a library By placing your object templates in a library they can easily be distributed to other locations or computers by copying the library file e g libraryname lib NOTE do not add to Opto 22 libraries You should not save your new object templates to Opto 22 libraries Opto 22 libraries are regularly updated and the new libraries replace the existing ones so your templates would be overwritten Instead you should create a new library in which to store your own object design work Refer to section 5 3 Edit Libraries for more information In the Add Edit Templates dialog box do the following to add an object template to a library 1 Click the template that you want to add to a library It is highlighted in blue 2 Click Send Template to Library The following dia log box is displayed Select library ANN Entry name J read bject_1 Leave template in workspace when done OF Cancel
108. en to open the workspace in the main window You can also double click a file name to open 1t 4 3 Close a Workspace Select Close Workspace from the File menu to close the current workspace and start a new workspace The follow ing prompt appears Workspace changed E 7 Save changes to simple display qly Click Yes if you want to save the workspace that was loaded or click No if you do not want to save it A new unnamed project is started using the default resources from the previous workspace At this point you can start a new project or open a different project using the Open Work space option 4 4 Save a Workspace The first time you save a new workspace the Save As dia log box appears so that you can enter a name for the work space file see section 4 4 2 Then when you save the file it is saved to the file name you entered If you want to make a copy of the workspace or change the file name use Save Workspace As Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 OptoTerminal Qlarity Foundry User s Manual If you want to transfer a workspace to another computer use the Collect for Output function see section 4 4 3 below 4 4 1 Save Workspace To save a workspace click Fl on the toolbar or select Save Workspace from the File menu If you have already named the workspace the file is saved If it is a new workspace and you have not yet named it the Save
109. endix A Glossary of Software Terms but you can move an object up or down the list using drag and drop The Object Tree also contains icons that can be used to show hide or lock unlock an object instance as follows Click to show eye open or hide eye closed the object instance in the work area This is useful if you have objects stacked You can hide an object if you want to see an object that is behind it y Click to lock lock closed or unlock lock open an ff object instance When an object is locked it cannot be changed or moved with the mouse 3 7 1 Globals In Layout View default view you see only the Globals branch of the Object Tree Under the Globals branch all object instances defined for the workspace are listed To add a new object instance to a workspace you can right click Globals and select New Object Instance from the shortcut menu or you can use the icons on the Object Pal ette If any global code has been written for the workspace you can click Globals and see the object properties associated with the global code Global properties apply to the entire workspace OptoTerminal Qlarity Foundry User s Manual 3 7 2 Object Templates A Qlarity program consists primarily of objects An object template contains the programming code that defines the object and how it behaves Once object templates are cre ated any number of object instances based on the tem plate can
110. ent_2 and so on through each EZEvent object event From the drop down list select the event that you want to trigger the action Valid events are determined by your hard ware configuration and may include e A touch screen press press and move or release e A keyboard key press or release e A change in a value increment or decrement e A timer action eventsourceobj If the source of the data to be transferred is an object select the source object from the drop down list you also need to select the eventsourceproperty If the source is a speci fied value rather than an object enter the value in the eventtargetvalue property field eventsourceproperty Type the name of the property that contains the source data from the source object s properties Be sure to type the property name exactly as 1t appears in Object Properties eventtargetobj Select the target object for the action from the drop down list The target object is the object that will be changed when the event takes place such as moving a gauge eventtargetproperty Type the name of the target object s property that will be changed when the event takes place Be sure to type the property name exactly as 1t appears in Object Properties eventtargetvalue If you want a specific value transferred to the target prop erty rather than data from a source object when the event takes place enter it in this property If you are entering an array e
111. er defined functions and object methods are called when the message they handle is generated Message Handling System System that handles event processing for the OptoTerminal When an event occurs the system software and or hardware drivers generate a message indicating that the event has occurred The message is passed through the message han dling system in the Qlarity based system software which reviews the object hierarchy and determines which object gets the message and in what order the message will be pro cessed In order to process a message an object must be enabled which also causes area and container objects with a defined area to be drawn on the screen Disabled objects do not process most messages Methods Functions contained in an object comprising much of the code portion of the object The methods for each type of object are defined in the object template but each object instance may override some of the object template s meth ods Methods define the behavior of an object at runtime and typically either manipulate or depend on the values of the object s properties Method Override A function in an object instance that overrides or replaces the method defined in the object template Each object instance may override some of the template s meth ods The override function has the same name and parame ters as the template method and the code in an override may call the template method if desired
112. ewHeight gt else tmp as integer handleNum handleNum 2 mod 8 newX xPos endif newY yPos endif newWidth width newHeight height xPos newX yPos newY 1f handleNum 0 then width newWidth newX xPos dx height newHeight newWidth width dx newY yPos dy Relocate me XPOS yPos newHeight height dy Resize me width height elseif handleNum 1 then newY yPos dy Save any changes we just made newHeight height dy Tool _ Persist xPos elseif handleNum 2 then Tool Persist yPos newY yPos dy Tool Persist width newHeight height dy Tool_Persist height newWidth width dx endfunc elseif handleNum 3 then Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 OptoTerminal Qlarity Foundry User s Manual When the user drags a resize grip in Layout View the object being resized receives a MSG_TOOL_MOVEHANDLE message from Qlarity Foundry The grip being manipulated and the change in position are passed to the handler as parameters The handler typically determines which grip is being dragged calculates its new size and position updates its properties requests a redraw and persists the values with Tool_Persist This is what the boilerplate code does There is also some validation code to prevent the object from being sized to a height or width of 0 The handleNum parameter is passed to the handler as a reference which allows
113. fine functions for the terminal at the OptoTerminal you use a user application to perform the functions When Qlarity Foundry starts a dialog box appears so you can open a workspace Welcome to Qlarity Foundry Recent Files CQ larity Foundry alearont ql CA Qlarnte Foundry scaleoby gly CA Qlante Found keyboard test gly COllat Foundry photoshoot gly CA Qlante Foundry g 5photoshoot2 gly COllat Foundryauto gly C Qlarity Foundry basetemplate gly COllat Foundry checkers gly CA Qlante Foundry dataentroby gly J E TM Open Selected Gil ty Open Other File by 051 Corporation Object Based Programming Start Mew M Begin editing in Layout view a Open Selected Recently opened files if any are listed To open a recent file click the file name to select it then click Open Selected or double click on the file name The work space is opened in the main window Only one workspace at a time can be open in Qlarity Foundry Open Other File Click Open Other File and the Open dialog box appears showing workspaces in the default folder Use the Windows tools to change folders if necessary Click a file to select it then click Open The workspace is opened in the main window Start New To start anew workspace click Start New The New Qlar ity Project dialog box appears Refer to section 4 1 Start a New Workspace for information Enable or disable the follow
114. for this include the following A ba Layout scale 1 Outline all objects TA Layout View Code View OptoTerminal Qlarity Foundry User s Manual Ox Object Palette progobis NY a A En p a gt E FE 3 mal a Ya O p A Lighting Ju C nay e T a Oo TN Outside On SO Outside Off E e ssis pal ANT te t03 t141I5 1B tr tre ql bel_all_tl bell_all_tr bell default default 327 14 ue e Display setup including landscape portrait and gray scale color e Valid input devices type of key input used with your ter minal e Touch key legend border around the edge of the touch screen for a Opto 22 standard touch key legend enable if you are using a touch key legend disable if you are not e Simulation setup volume in Simulation mode and Com munications window defaults The Communications window simulates the data received and sent via the com munications port Click gt on the toolbar or select Settings from the View menu Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 OptoTerminal Qlarity Foundry User s Manual The Qlarity Foundry Preferences dialog box is displayed Qlanty Foundry Preferences Terminal Layout Editar Compile Simulation Input TT Keyboard TF External Keypad Select Display Setup Dimensions Y TouchScreen te Landscape Communications Portrait Nu
115. functionality of the template method is desired it can still be called from inside the override method Customizing object instances by changing their initial prop erties requires no programming and is discussed in Chapter 8 Conversely overriding methods does require some programming and is the main focus of this chapter 9 3 Qlarity Code for Objects The following sections describe the Qlarity code used to define an object and the method overrides in an object tem plate 9 3 1 Property Initializations Code for a typical object includes several lines in the fol lowing format init lt propertyname gt lt value gt lt propertyname gt This is the name of one of the object s properties lt value gt This assigns the initial value for the property in the applica tion If a property is not shown it is assigned the default ini tial value from the object template Changing lt value gt in one of these statements is the same as changing the property value in Object Properties 9 3 2 Method Overrides Most methods defined in an object template may be overrid den in any instance created from the template Indeed many objects have methods that are intended only for override the default method in the template does nothing This allows an object to provide or publish a way to customize the behavior of the object without modifying the template For example a timer object might provide a function called Alarm
116. g workspace Refer to section 4 2 for information Close Workspace Select this option to close the current workspace and open a new workspace Save Use this option to save the current workspace Refer to section 4 4 for information Save Workspace As Select this option to save a copy of the current workspace to a different file name The Save As dialog box is displayed Enter the new file name the extension is added automati cally and click Save Collect for Output Use this option to transfer a workspace to another computer See section 4 4 3 for information Compile Use this option to compile the current workspace into the format required for a user application A workspace must also be compiled to properly display in Layout View Refer to section 4 5 for information on compiling a workspace Generate BFF File You can download a user application that is not currently loaded in Qlarity Foundry to the terminal but the file must be in binary file format BFF Use this option to save a file to BFF Refer to section 4 6 for information Download Application Select this option to download files to the terminal You can download the currently loaded workspace any BFF file or a firmware upgrade Refer to Chapter 7 Download Soft ware to the Terminal for information Recent Files After you have created and saved Qlarity files you can use this option as a shortcut to open files that have been recently opened Clic
117. he workspace is compiled and the objects in the library are no longer available for use in the workspace 27 5 3 3 Edit Library Library editing functions require an understanding of Qlar ity programming Refer to Chapter 9 Intermediate Design and Chapter 10 Advanced Design for informa tion on Qlarity programming NOTE do not edit Opto 22 libraries You should not edit Opto 22 libraries Opto 22 libraries are regularly updated and the new libraries replace the existing ones so any changes are overwritten You should edit only libraries that you created see section 5 3 5 Create a New Library You can modify an object template by importing it into your workspace see section 5 1 1 Add a New Object Template In the Libraries dialog box click a library to select 1t then click Edit Library and the following dialog box is dis played Edit Library Path Static Mame common Icon Foreground Icon Background Li Version jot 3 Warming Any changes you make to libraries may affect other projects Additionally any changes will take effect immedediately and cannot be undone Edit Entry Back bitmap Bitmap 0 00 Back button Source 012 Rename Entry Commonblisc Source O15 thernet Source PUL Remove Entry ezactiwetab Bitmap 0 00 ezhory Bitmap 0 00 ezpew Bitmap 0 00 Set Ent Version eztab Bitmap 0 00 Gauge S Ounce 0 10 Grid Source 0 10 Add New Entry homebitmap Bitmap 0 00
118. hows an example of Object Properties for an area object Pame ___ SetTemp enabled false parent defaut bordercolor _ rgb_whit bgcolor __ eol_74 bordenyidth 0 transparent false nextscreen empty previousscreen empty borderstyle screen_flat switchrmode enabledizable The first column lists the name of each property Property names are defined in the object template The middle col umn optionally displayed see section 6 2 Layout lists the data type of each property for information only The property settings which you can change are listed in the third column Click the property that you want to change Enter the new property setting in the third column You can enter new property settings by typing the new information type over the default setting or by selecting from a drop down list or dialog box In the following illustration the property ezimage is selected This is the name of the bitmap image used in the object instance The drop down list shows all bitmap images available for use in the object instance A different image can be selected by clicking it Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 52 Name String ezimage_5 enabled boolear true parent objret default poz integer 46 ppos integer af transparent boolean falze transparentcolor color rgb_magenta ezimage bitmap blirik boolear blinkrate integer event ma agee
119. inal Click the Layout View tab or Code View tab at the bottom of the work area default location to change views Click the Simulation tab to start the terminal simulation Layout View is a graphics mode used to lay out the terminal display Generally unless you are making changes to the programming code you will work in Layout View Code View is used to write or edit an object s programming code You will generally only work in Code View if you are customizing objects or creating your own objects Refer to section 3 8 for more information on the Layout and Code Views Refer to section 3 9 for more information on Simulation mode Messages and Errors The Messages and Errors window displays any errors or other messages generated when the workspace is compiled or during a debug operation These messages can help you identify and correct problems with the workspace Status Bar The status bar shows the status of the workspace and the coordinates at which the mouse pointer is positioned in the work area Also if you position the mouse pointer over an option on a menu or a tool on the toolbar the function of the option or tool is displayed in the status bar 3 4 Menu Options The following sections describe the options available on each menu on the menu bar 3 4 1 File Menu New Workspace Use this option to start a new workspace Refer to section 4 1 for information Open Workspace Use this option to open an existin
120. inal Programmer s Reference Manual For example the handler described above could check the value of a global variable named threshold and enable an object named cal_screen if threshold is greater than 10 The complete function example fol lows func timer handles MSG TIMETICK 1f threshold gt 10 then Cal_screen enabled TRUE endif endfunc 5 Repeat steps 3 and 4 for as many handlers as desired Do not add two handlers for the same message 6 Click or select Compile from the File menu to compile the workspace Any errors in the new source code are identified by messages in the Messages and Errors window If no errors are present the compiled workspace is returned to Layout View 9 6 Create a New Object Template The method override mechanism provides a powerful way to customize an individual object s behavior and response to events However you may want to change the behavior of all instances of a particular object Adding an identical override to all objects from a particular template would be Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 OptoTerminal Qlarity Foundry User s Manual tedious and prone to error It is better to modify an existing object template to create a new object template NOTE do not modify code in libraries It is recommended that you do not directly modify the code in the Opto 22 standard object libraries Opto 22 occasion ally update
121. inary resource in your application if you wanted the terminal to communicate with an embedded device with no PC con nection You could for example add a configuration or firmware file to the application as a binary resource file and then use the GetBinaryResource API function to download the file from the terminal to the embedded device when the application is running 5 3 Edit Libraries Object libraries are provided by Opto 22 and other sources to assist you in designing user applications Each library OptoTerminal Qlarity Foundry User s Manual contains several predefined Qlarity objects This enables you to add object instances to your workspaces without the need to program new object templates When you add a library to your workspace the objects in the library are added to the Object Palette and to the drop down list in the Instance Properties dialog box right click anywhere in the Object Tree and click New Object Instance NOTE default libraries When you create a new workspace you have the option to add default libraries to the workspace You can remove a default library or add new libraries to the workspace using the Edit Libraries option NOTE library object templates Object templates in libraries are not listed under Tem plates in the Object Tree Only object templates created in the workspace are listed under this heading However you can create a new object template based on an existing library
122. ing resizing and changing the order of objects 8 3 1 2 Add an Object From the Shortcut Menu Do the following to add a new object instance from the Object Tree shortcut menu 1 Right click anywhere in the Object Tree to display the shortcut menu 2 Click New Object Instance The Instance Properties dialog box is opened All available objects are listed in the drop down list at the Type field as shown below Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 50 Instance Properties Fa Name Newinstancel Type ie BackButton id 25 Serial Tabcontainer A Tabs m Trendchart E scale EZB uttonB CF fl EFEventT imer 3 At the Name field type a name for the new object type over the default name Each object in the work space must have a unique name An object name has no size limitation but must start with a letter A name can not contain spaces but may use the underline character _ The percent pound and dollar sign symbols can be used at the end of the name 4 At the Type field click the drop down list and select the type of object that you want to add After you select an object it is added to the work area at its default loca tion and is listed in the Object Tree The newly added object remains selected and its object properties are displayed You can edit the properties as required 8 3 2 Move Resize and Reorder Objects To select a
123. ing option Begin editing in Layout View If enabled a workspace is automatically compiled and shown in the Layout View when it is opened If disabled the workspace is displayed in Code View and will need to be compiled before it can be displayed in Layout View You can change this setting using the Settings function Compile tab see section 6 4 Compile Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 3 3 Main Window The Qlarity Foundry main window is shown below Qlanty Foundry Hew Workspace Globals File Edit View Tools Menu Bar Help Es a a ExceptionDisplay FF ia ai ScreenBlanker Object Tree View Tabs Layout view Code View x Ho Errors Tee Compile Status Bar Compiled No errors OptoTerminal Qlarity Foundry User s Manual Eline tow O Fb E Lil SSE enh fo vl TA id Properties Events Globals Object Properties Messages and Errors Window 20 263 A Menu Bar The menu bar contains the File Edit View Tools and Help menus Refer to section 3 4 for a brief description of the menu options You can access all Qlarity Foundry options from the menus Toolbar The toolbar contains tools that provide quick links to com monly used Qlarity Foundry functions The tools available change depending on the selected view mode Layout View or Code View Refer to section 3 5 for a description
124. initial communications settings that the com port s use in Simulation View Mod senal orb Settings Remember to specify the terminal hardware with the Terminal tab Speaker Volume Click and drag the slide button to adjust the volume in Sim ulation mode Mute Enable this option to turn sound off in Simulation mode Use PC network connection to simulate Ethernet If you select this option your computer s network connec tion if available will be used in Simulation mode to trans mit and receive data requested by the application Disable this option if you do not want Qlarity Foundry to access the network in Simulation mode Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 OptoTerminal Qlarity Foundry User s Manual 6 5 1 Serial Port Setup You can set up Simulation mode to send and receive appli cation data through a serial port or ports on your computer Use the serial port setup to set up the computer s ports to simulate the serial ports on the OptoTerminal The terminal s available serial ports are listed To specify the PC port that you want to use for the simulation and to set up the port s configuration select the terminal port from the list and click Modify Serial Port Settings or double click the port The following dialog box is displayed Simulation Port Settings E Setup G70 port com for simulation Baud Rate 115200 Data Format Jeni EA Flow C
125. is option to find code in the displayed object instance or template and replace it with specified code In the Find What field enter the characters or code you want to find In the Replace With field enter the code with which you want to replace it Click Find Next to find the code Then click Replace to replace it Or click Replace All to automatically find and replace all occurrences of the code To find only characters matching the entered case upper or lower select Match Case Goto Bookmark Code View only Select this option to go to the next bookmark in the dis played object s code Use Set Bookmark to add or remove bookmarks in an object s code Set Bookmark Code View only Select this option to add or remove a bookmark in an object s code at the cursor location Bookmarks make it possible to find a location quickly which is useful in objects with several lines of code 3 43 View Menu Toolbar Select this option to show or hide the toolbar Status Bar Select this option to show or hide the status bar Misc Bar Select this option to show or hide the Layout Scale and Out line All Objects functions next to the toolbar Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 OptoTerminal Qlarity Foundry User s Manual Messages and Errors Select this option to show or hide the Messages and Errors window which displays any errors or other messages gener ated when th
126. isplayed Save As 3 GlartyFoundry lt Es a slidergauge bit Save In ales File name Save as type Clarity application binary files bt Cancel OptoTerminal Qlarity Foundry User s Manual 3 In the File name field type a name for the BFF file or accept the default file name you do not have to type the extension The workspace file name with a bff extension in place of the gly extension is used as the default 4 Click Save to generate the BFF file You can download the BFF file using the Download Other BFF option in the Download Application function File menu Refer to section 7 3 Download a BFF File for information Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 CHAPTER 5 TEMPLATES RESOURCES AND LIBRARIES 5 1 Add Edit Templates Creating and designing object templates is an advanced function which is covered in depth in Chapter 10 Advanced Design This section provides an overview of the Add Edit Templates function Use Add Edit Templates to create a new object template The new template may be blank it may contain only boiler plate code or it may be based on a library object template New object templates are added to the Template branch of the Object Tree After adding a template you use Code View to add or edit your custom programming code You can also use the Add Edit Templates function to change the name of a
127. k Recent Files and the five most recently opened files are listed Click the file that you want to open Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 Exit Select this option to exit Qlarity Foundry 3 4 2 Edit Menu The options in the Edit menu change depending on whether you are in Layout View or Code View Cut In Layout View select an object in the work area then select this option or press lt CtrI gt lt X gt to cut the object from the workspace In Code View select code then select this option or press lt Ctrl gt lt X gt to cut the selected code from the workspace The object or code remains in the Win dows buffer until replaced by another cut or copy oper ation Copy In Layout View select an object in the work area then select this option or press lt Ctrl gt lt C gt to make a copy of the object In Code View select code then select this option or press lt Ctrl gt lt C gt to copy the selected code The object or code remains in the Windows buffer until replaced by another cut or copy operation Paste In Layout View select this option or press lt Ctrl gt lt V gt to place a cut or copied object in a new location in the same workspace or in a different workspace In Code View select this option or press lt Ctrll gt lt V gt to place cut or copied code at the cursor position in the same or a different work space or in a differen
128. l G70 display 1s 320 pixels in width by 240 pixels in height 320 x 240 and the Opto Terminal G75 is 640 pixels in width by 480 pixels in height 640 x 480 Therefore you can easily determine what size to make your bitmap images so they will be in proportion to the size of your terminal Refer to your terminal s specifica tions for its exact size Transparent Background You can specify that a color in a bitmap image become transparent in the workspace If you want the background of a bitmap image to be transparent in the workspace make the background a color that is not used in the bitmap then select the background color as the transparent color in the bitmap object properties in Qlarity Foundry Bright magenta and bright green are often used as transparent background colors 5 2 7 Fonts OptoTerminals support BDF raster and TrueType fonts Use the following guidelines to help you determine which fonts to use in a workspace Scalable and Non scalable Fonts BDF raster fonts are non scalable which means that you need to load a separate font file for each point size e g Arial 8 Arial 14 Arial 20 etc TrueType TT fonts are scalable which means that a single font can typically be scaled to several different point sizes Rotating a Font A TT font can be rotated to any angle A BDF font can only be displayed at the angle at which 1t was created Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0P
129. lette e Object Tree Opto 22 Fax 800 5832 0PTO 6786 Web www opto22 com Phone 3500 321 0P TO 6786 44 Qlarity Foundry auto_qly Globals Fie Edit View Tools Help Daw WSs BROS E Object Tree e E af ContrastLighter E af ContrastD arker a af IsMoisy ae E af Secure Warm AMP LA ol Tempwam Hip e SetTemp S y LabelBDF_22 i CursetTemp En a SetNumkeppac 2 a SetT empLabel ERr ai E sE xceptionDispla CAR g MainForm i DecoLine_1 sE af DecoLine fee ai Security ey fen al Lighting ie fon a of HVAC View A g viewTopLett A g YiewTopRight m g viewBottomLefl HH g viewBottomRig Ej ai Ex nagleT ex S q BackT oier 5 2 af lightbr DA af lightcontrolb MA af HVAC Boti A S g sec_bottom Ty af HVAC Botti a ai AlEmp i El fi Mo Errors All four windows are open by default If one is inadvert ently closed you can open it from the View menu NOTE workspace appearance variations In the illustration above and elsewhere in this chapter the objects in the Object Palette and Object Tree may differ from what you see in Qlarity Foundry Object names may also be different This is the result of ongoing improvements to Qlarity Foundry libraries 8 1 2 Simulate the Terminal Display Qlarity Foundry requires information about the display con figuration of your OptoTerminal to simulate it accurately in the work area and in Simulation mode The settings required
130. lication Two of the libraries provided with Qlarity Foundry that are used at the basic design level are Common library common lib e Programmable objects library progobjs lib These libraries include the following types of objects e Container objects with tabs or buttons to switch from one screen to the next Common library e Area objects with event functionality Programmable objects library Refer to section 8 4 Event Builder for information on configuring objects to respond to events e Communication objects Common library Refer to section 8 4 Event Builder and section 8 5 Communi cation Objects for information on how to use communi cation objects to send data to another device through the OptoTerminal s serial or Ethernet port Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 OptoTerminal Qlarity Foundry User s Manual The Qlarity Foundry libraries are continually being added to and improved You can obtain the latest libraries at Opto 22s Web site www opto22 com Also on the Web site you will find descriptions of the objects included in the libraries 8 2 Understanding Qlarity for Basic Design Before you can effectively design a user application you need to understand some basic Qlarity concepts which are explained in the following sections 8 2 1 Workspaces and User Applications A workspace is a Windows based file created in Qlarity Foundry that is co
131. ly create objects that might be useful for others Opto 22 encourages Qlarity programmers to submit their object template designs to the Opto 22 Web site www opto22 com where they can be shared with oth ers Questions and feedback about the Qlarity programming lan guage and the Opto 22 OptoTerminal should be sent via e mail to support Opto22 com You should also check the www opto22 com Web site occasionally for software and documentation updates new library objects and support materials Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 82 OptoTerminal Qlarity Foundry User s Manual Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 APPENDIX A GLOSSARY OF SOFTWARE TERMS API Function A function that is called from the user application to interact with the Qlarity based system software firmware and hardware You use API functions to draw to the screen ren der text and bitmaps send characters to the serial and net work ports enable disable objects manipulate object order in the hierarchy perform complex math and so on Area Object An object that directly interacts with the terminal display by drawing something on the display and or processing area based messages Examples of area objects include text objects bitmap objects and line objects BFF File Format Binary file format BFF required for a user application to run on a OptoTerminal When a worksp
132. mber of serial ports 2 Mise Manufacturer ID MID 65535 Grayscale fe Color Tabs are available to define your OptoTerminal display to define the layout of the Qlarity Foundry work area which includes the Opto 22 standard touch key legend setting to set up compile defaults and to set up the Simulation dis play Refer to Chapter 6 Qlarity Foundry Preferences for more information 8 1 3 Drawing Aids When arranging the graphical objects on the terminal dis play proper alignment is important Qlarity Foundry pro vides the following tools to assist you with object layout Layout scale To change the scale of the work area click the drop down arrow and select the scale from the drop down list Outline all objects T Select this option to draw a line around all defined objects This is useful when you want to know the exact border loca tion of each object or when one or more objects was acci dently moved out of the work area 45 Grid You can display a grid over the work area to help you more accurately place and align objects You can turn the grid off and on and change the spacing and color of the grid lines Snap to Grid If enabled this feature forces objects to snap to the near est grid line when added or moved The top left corner of an object s rectangle snaps to the nearest horizontal and verti cal grid lines when you release the mouse button To customize the grid an
133. menu to compile the Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 68 workspace Any 5s in the new source code are identi fied by messages in the Messages and Errors window If no errors are present the compiled workspace is returned to Layout View Notice that the Object Palette contains a new icon rep resenting the new template By default the new tem plate s icon is the same as the icon for the library template that served as the basis for the new template except that the background color is different Icons for local templates in a workspace appear before library template icons To edit the icon or change the name click on the toolbar or select Add Edit Templates from the Edit menu Click the template name in the Add Edit Tem plates dialog box then click Edit Icon Refer to section 5 1 2 Edit Icon for more information OptoTerminal Qlarity Foundry User s Manual 9 7 Where to Go From Here This chapter introduced the basics of programming applica tions using Code View and the Qlarity programming lan guage As your familiarity with Qlarity increases your ability to program complex tasks and customize your appli cation will grow To strengthen your background in Qlarity you should read the OptoTerminal Programmer s Reference Manual in particular Chapter 1 QTERM G70 G75 Soft ware Fundamentals and Chapter 2 Qlarity Language Syntax Next proceed to Chapte
134. message Smallbelay func Startup EE a af EsExceptionDispla handles meg_init EGR g MainForm af DecoLine_1 ai DecoLine ORY e af Security view SRH a a LightingView SEH a i HAC iew E mA 5 viewTopLett Hip MiewTopRight Hip fy ViewBottomLefl E Lp gt Sy ViewBottomRig ee af Ex ngleT ex E Bf BackT oier EHA a lightbr DA 2 af lightcontrolb SS TA e af HVAC Bott Hip g sec_bottom Hip d H AC Botte Updatecur Temp i UpdatesetTemp il endiuno Mo Errors te E af ANB mp 1 al 9 2 Understanding Qlarity for Intermediate Design Before you can effectively design a user application at the intermediate level you need to understand some basic Qlar ity concepts which are explained in the following sections 9 2 1 Qlarity Programming Language Qlarity syntax is based on the BASIC programming lan guage with extensions added to handle creation and manip ulation of objects This chapter provides examples of programming code written in the Qlarity language For additional examples and information refer to the OptoTer minal Programmer s Reference Manual 9 2 2 Objects and Templates A Qlarity application consists primarily of objects An object template defines a new type of object with certain properties and behaviors Any number of object instances gt eTopRight 1 zBEottomLeft RegisterMsqHandler default sendUserMsg Smallbelay 3 y oO zA 5 2 zB
135. mpiled into a user application Work space files are stored as plain text and typically have a gly file name extension User application files have a bff exten sion In Qlarity Foundry you use a workspace to define functions for the terminal at the OptoTerminal you use a user appli cation to perform the functions When a workspace is compiled into a user application the Qlarity interpreter initializes the user application in Qlarity Foundry so you can see the results You can then download the user application to the OptoTerminal 8 2 2 Qlarity Objects A user application is constructed of Qlarity programmed objects An object instance 18 an occurrence of an object in the user application An object template contains the pro gramming code that defines an object When you create a basic design you will use objects from existing libraries several libraries are provided with Qlarity Foundry There are three types of objects as follows All three types of objects can be found in Opto 22 libraries Non drawable object An object that serves a function not related to the display e g key definition communications etc Area object An object that can be represented visually on the terminal display An area object might be any of the following e Bitmap an imported bitmap image 47 e Lines circles or rectangles may include custom borders and fill colors e Text labels headings or a field where text may b
136. n existing template Click on the toolbar or select Add Edit Templates from the Edit menu and the Add Edit Templates dialog box is displayed You can also right click anywhere in the Tem plates branch of the Object Tree and click Add Edit Tem plates on the shortcut menu E Add Edit Templates New Template O Non Drawable Ares Object 0 Eontainer 5 1 1 Add a New Object Template In the Add Edit Templates dialog box do the following to create a new object template l Click New Template and the following dialog box is displayed Hew Template Wizard 3 Create a template ready to operate in Glarity Foundry Create a completely blank template Create a template based on a pre existing library object Template name Area Object E Cancel Object type Select one of the following options to start the new template Create a template ready to operate in Qlarity Foundry This option creates a new object template with suffi cient programming code to function as an object and display on the screen Additional programming 1s required to define the object s function appearance and so On Create a completely blank template This option creates a blank unprogrammed object tem plate Create a template based on a pre existing library object This option creates a new object template using the programming code from a library object you specify in the Based on box
137. n object to move resize or reorder click on it The selected object is outlined with a colored box You can only select one object at a time You cannot move or resize a locked object Press lt Tab gt to move forward from object to object in Z order Press lt Shift gt lt Tab gt to move backwards NOTE Object Properties When you press lt Tab gt Object Properties changes to match the newly selected object 8 3 2 1 Move an Object To move an object do one of the following e Use the mouse Click in the center of the object hold down the mouse button and drag the object to a different position You can hold down the lt Shift gt key while mov OptoTerminal Qlarity Foundry User s Manual ing an object to limit its movement to horizontal vertical or a 45 angle e Use Object Properties Enter a new x and or y position integer in Object Properties 8 3 2 2 Resize an Object To resize an object do one of the following e Use the mouse If the object has resize grips sizing handles you can click and drag any grip to resize the object Click and drag a corner grip to maintain the height width proportions while resizing Resize Grips E e Use Object Properties Change the height and or width integer in Object Properties 8 3 2 3 Change the Order of Objects You can change the Z order of an object or the parent child relationship simply by changing the object s position in the Object Tree To move an
138. n to reflect the current status of On e Enables the spinner object TurnOff triggers the following actions e Changes the caption above the toggle button to reflect the current status of Off e Disables the spinner object 8 4 4 3 Keypad Demo The Keypad Demo provides a keypad that can be used to enter numerical data to be sent to a controller The follow ing objects have programmed events Enable_button A press or click event enables the numeric keypad makes it viewable so it can be used for data input Numeric_keypad Two actions have been programmed to the keypad e When the lt Enter gt key is pressed any data entered the value is posted to the Keypad_value text box located above the keypad e When the lt Enter gt key is pressed the value is sent out the serial port to a controller expecting a value 8 4 5 Qlarity Code and Event Builder While Event Builder requires no programming experience it uses the Qlarity programming language Events created with Event Builder generate Qlarity program code This means that it is possible to develop events in Event Builder and then add advanced functionality in Code View It is also useful if you are learning the Qlarity programming lan Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 58 guage to create events using Event Builder and then study the program code generated If you modify an event in Code View and late
139. nal keypad configuration create a new configuration or modify an existing one to match the actual keypad that you are using with the terminal 6 2 Layout Click the Layout tab to define the layout of the Qlarity Foundry work area to simulate your terminal display Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 32 Qlanty Foundry Preferences Terminal Layout Editor Compile Simulation mi Show legend around I Hilight object under the mouse EREN onee Grid Grid Spacing ho IY Show Grid T Snap to Grid Show data types in properties window e Show popup help for objects amp properties Tab location Bottom Layout View colors double click to set Display Border Selected Object Hot object Dragging Objects IY Preview while dragging Object outlines Grid Time the mouse must be held still before a resize takes effect 250 v Allow locked objects to be mowed within the Object Tree Cancel Show legend around display With touch screen displays you can add a border around the display for a stick on touch key legend If you are using a touch key legend select this option If you are not using a touch key legend leave the checkbox empty Grid Spacing You can display a grid over the work area to help you more accurately place and align objects Enter the space between grid lines in pixels between 2 and 25 Show Grid S
140. nclose it in square brackets and separate each num ber by commas e g 10 20 30 40 50 Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786
141. nes to connect each resize grip newX xPos dx The closed parameter determines whether a line connecting newWidth width dx the first and last grips will be drawn Ordinarily this is endif desirable However certain objects such as the Line and PolyLine objects in the Opto 22 Common object library do if newWidth lt 1 then not enclose a space on the screen and the last line is not nee foe a EA E desirable A value of TRUE causes this line to be drawn ee ae ee ot gees ae tmp handleNum mod 4 This property also determines whether clicking inside the US j ES 1f tmp 0 then object will select it in Layout View handien e NAO elseif tmp 2 then The code for the MSG_TOOL_MOVEHANDLE handler is handleNum handleNum 2 as follows else handleNum handleNum 4 mod 8 This function is called in response to a gt end it user moving a resize grip within Qlarity gt endif Foundry handleNum is the index into the gt arrays that were returned by the handler gt if newHeight lt 1 then for MSG_TOOL_GETHANDLES You should gt newY newY newHeight 1 return true from this function newHeight newHeight 2 func ToolMoveHandle handleNum as gt tmp handleNum mod 4 reference to integer dx as integer dy gt if tmp O then as integer handleNum handleNum 6 mod 8 handles MSG_TOOL MOVEHANDLE elseif tmp 1 then handleNum handleNum 4 mod 8 dim newX newY newWidth n
142. ng The handler that caused the exception is aborted but the current message continues to propagate to other objects until it has been processed to completion At this point if there are any exceptions in the system exception stack the system software generates a MSG_ERROR message which is processed immediately 71 1 e before any other pending messages are processed MSG_ERROR is a special message that can only be pro cessed by handlers in the Global Code space This allows applications to provide a last chance global error handler routine that receives all unhandled exceptions The MSG_ERROR handler has no parameters so the exceptions must still be retrieved by calls to GetException Retrieving an exception by calling GetException removes the exception from the system exception stack Therefore calling GetException terminates an exception unless it is rethrown by calling the Rethrow API function If the exception has not been handled 1 e removed from the system exception stack after MSG_ERROR is pro cessed or if there is no global MSG_ERROR handler the exception is either discarded for exception levels of EXLEV_IGNORABLE or lower or the exception location and description are transmitted from the primary serial port for exceptions of EXLEV_SYSTEM or higher The typical check error block or global MSG_ERROR handler calls GetException to retrieve information for the last thrown exception check
143. not been added to the workspace 2 Select one or more libraries from the list To select multiple libraries that appear consecutively in the list press and hold lt Shift gt then click the first and last library in the group you want to select To select multiple non consecutive libraries press and hold lt Ctrl gt then click each library that you want to select The objects in the selected library or libraries are dis played at the bottom of the dialog box 3 Click OK to close the dialog box and the selected libraries are added to the workspace The objects in the new libraries are added to the Object Palette 4 To add a library that is not listed click Add Other Library and an Open dialog box appears Select the library or libraries that you want to add change the folder if necessary and click Open The library is added to the workspace 5 Click Close to save your changes and exit the dialog box The workspace is compiled and the objects in the new library are available for use in the workspace 6 Save the workspace to save the information to disk 5 3 2 Remove Library Do the following to remove a library from the current work space 1 All libraries that are loaded in the workspace are listed Click the library that you want to remove It is high lighted 2 Click Remove Library and the library file 1s removed from the workspace 3 Click Close to save your changes and exit the dialog box T
144. ntry in the Entry Name list to select it then click Edit Entry to edit the programming code of the selected object This function 1s only available for source type entries The object template is displayed in a text editor similar to Code View as shown below El Edit Library Entry Line of Xx Copyright 2001 OSI Corporation Permission is granted to copy distribute and modify this code provided that this copyright statement is preserved LEATHER KATH AATHKK AHH AAHTKAAKKARAHHKATATKAAATHKATAHHKKAAHEKAHHKAAHTRAHHTATASH dim enabled as boolean init enabled true func enabled newval as boolean enabled newval Enable me enabled endfunc dim parent as objref func parent newval as objref parent newval Attach me parent endfunc dim x1 as integer init x1 O func x1 nevVal as integer xi newVal Adjust i endfunc jae a o Line 1 Col 1 Y Cancel Edit the code and click OK when you are finished to save the changes OptoTerminal Qlarity Foundry User s Manual 5 3 3 2 Rename Entry Click an entry in the list to select it then click Rename Entry to change the name of the selected entry A dialog box is displayed for you to type the new name Click OK to apply the change and close the dialog box 5 3 3 3 Remove Entry Click an entry in the list to select it then click Remove Entry to remove the selected entry from the library A mes sage is displaye
145. nual Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 66 In the example above the completed function is as fol lows func average first as float second as gt float returns float return first second 2 0 endfunc 5 Repeat steps 3 and 4 for as many functions as desired 6 Press E or select Compile from the File menu to compile the workspace Any errors in the new source code are identified by messages in the Messages and Errors window If no errors are present the compiled workspace is returned to Layout View 9 5 3 Adda Global Event Handler to a Workspace Event handlers are functions that are called by the system in response to a message generated by an event such as a touch screen press or the receipt of characters through a serial port To add a global event handler to the workspace do the following 1 Select the Global Code space by clicking Globals in the Object Tree 2 Select Code View The editor window displays any cur rent global source code 3 Ona blank line in the editor window outside of any other function declare a new function by typing the func keyword followed by the name of the function a left parenthesis the parameters of the new function and a right parenthesis If the function returns a value the right parenthesis should be followed by the key word returns and then the type of the returned value Indicate the end of the function with
146. o override an object method in your application do the fol lowing 1 Add the Programmable Object that will be used to han dle the event e g ButtonBDF Timer 2 Select the object in the workspace in Layout View or in the Object Tree and select Code View 3 From the Events Overrides drop down list above the code select the method you want to override Select Show only event functions if you want the drop down list to displays only methods that have been designated event methods If Show only event functions is not selected all possible override meth ods are listed Move the mouse pointer over a method in the list to display a description of the function 4 When you select a method from the list code similar to the following appears beneath all code for the object func click endfunc 5 Between the func statement and the endfunc state ment add Qlarity code to implement the desired response to the event A typical event response might include code to set properties in this or another object The Qlarity code to do this is as follows lt objname gt lt propertyname gt lt value gt lt objname gt This is the name of the object whose property will be changed To assign values to its own properties the override function in an object can refer to itself using the me keyword as the lt objname gt lt propertyname gt This is the name of the property to change Opto
147. o the new workspace You can also add or remove libraries after you open the work space NOTE library object templates Object templates in libraries are not listed in the Object Tree under the Templates heading Only object templates created in the workspace are listed under this heading OptoTerminal Qlarity Foundry User s Manual To add a library to or remove a library from a workspace click ii on the toolbar or select Edit Libraries on the Edit menu A dialog box similar to the following is displayed Edit Library Remove library Create new library Add existing library Edit Natives Close Filename Status loaded v1 00 loaded v1 00 ExExceptionDisplay loaded v1 00 ExRadioCheck1 loaded sys1 20 common loaded sys1 20 progobis exangletext lib exexceptiondisplay lib exradiocheck lib common lib progobjs lib Entries Templates Ex naleT ext Source Ex naleT ext Click Add Library to add a new library to the workspace Click Remove Library to remove the selected library For additional information on libraries refer to section 5 3 8 1 5 1 Libraries Provided with Qlarity Foundry Qlarity Foundry includes libraries of object templates that allow you to create interactive complex user applications without entering any programming code After you add one or more of these libraries to a workspace you can change the object properties to customize the object instances in your user app
148. object see section 5 1 Add Edit Templates for more information To add a library to or remove a library from your work space click ii on the toolbar or select Edit Libraries from the Edit menu A dialog box similar to the one below is displayed Edit Library Remove library Create new library Add existing library Edit Natives Close Filename rogobjs lib o exscreensaver lib lo exexceptiondisplay lib cornmor lib ed Sys 20 rogobjs ed sys1 00 ExScreenSaver loaded sys1 00 ExExceptionDisplay loaded sys1 20 common Entries Templates ButtonBDF Source Source Source Source LabelTTF 4 ListBoxBDF E Spi Circle Source CheckBoxT TF EJListBoxTTF Spil DataGrid Source Circle ER NumberKeypad x tacl lied ownList f pes Pe DataGrid E QwertyKeypad 4 Tim p DF 5 lea m DropDownList RadioButtonBDF 22 Toc LabelT TF Source EM RadioButtonTTF ListBoxBDF Source z y All libraries currently in the workspace are listed Click a library to display its entries and object templates at the bot tom of the dialog box Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 OptoTerminal Qlarity Foundry User s Manual 5 3 1 Add Existing Library Do the following to add a new library to the workspace 1 Click Add Existing Library and a dialog box appears that lists all the libraries included with Qlarity Foundry that have
149. object to the workspace The optional second serial port can also be used by adding a second serial object Following are the properties of a Serial object OptoTerminal Qlarity Foundry User s Manual Name Type a name for the new object type over the default name Each object in the workspace must have a unique name An object name has no size limitation but must start with a letter A name cannot contain spaces but may use the underline character _ The percent pound and dol lar sign symbols can be used at the end of the name enabled If the object is to be enabled select true from the drop down list To disable the object select false parent To make the object the child of a parent object select a container object from the drop down list and the object instance 1s automatically moved and linked to the selected object in the Object Tree To move an object to the root con tainer select default comport From the drop down list select the communications port on the OptoTerminal from which the data will be sent If you have only one select COM1 sendtoport This property receives the data string that is to be sent through the serial port Data can be sent to this property from a serial object configured in Event Builder see section 8 4 or an EZObject see Appendix B When the serial object s sendtoport property receives data it auto matically sends the data followed by a
150. ode data transmitted by the OptoTerminal appears in the Communi cations window in hex format rather than text e g ABCD appears as 41 42 43 44 Wrap line on newline characters Enable this option 1f you want characters in the Communi cations window to wrap to the next line when a newline character is encountered Favor wrapping lines on word breaks If Wrap line on newline characters 1s enabled select this option to wrap to the next line after a word rather than between characters in a word whenever possible Show only transmitted data If this option is enabled the Communications window will display only data that is transmitted from the application program Disable this option to show both data transmitted both received by the application Non printable character Space character Newline and carriage return Enter the character that you want to appear on the screen in Simulation mode when a non printable space or newline carriage return character is encountered Click Default to enter the default character Maximum buffer size Enter the maximum amount of data in bytes to be held in the Communications window buffer When this number of bytes is reached data will be removed from the top of the Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 36 buffer as new data appears at the bottom Click Default to enter the default buffer size 6 5 3 Keypad Settings Thi
151. of each tool on the toolbar Object Tree Object instances that have been added to the workspace are listed under Globals and object templates are listed under Templates in the Object Tree Some objects may be auto matically added to a workspace when it is created including the following e ScreenBlanker blanks the screen after a period of inac tivity e ExceptionDisplay displays unhandled Qlarity Excep tions Work Area This is the area in the Layout View in which you place object instances to add them to the workspace The work area simulates the display of the OptoTerminal Object Properties Object Properties is displayed by default Click an object instance in the Object Tree or work area and its properties are displayed Refer to section 3 10 for more information Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 OptoTerminal Qlarity Foundry User s Manual Object Palette The Object Palette contains an icon for each object template in the workspace and in any active libraries You click the icons to add new object instances Move the mouse pointer over an icon to display the object s name Refer to section 3 11 for more information Layout View Code View Simulation To set up the workspace you can work in either Layout View or Code View The Simulation mode can be used after you have created a workspace to simulate the performance of the workspace objects on the OptoTerm
152. ontrol None Simulate on coms l PC Port COma Baud Rate From the drop down list select the initial baud rate of the PC port selected in Sim on PC Port Data Format From the drop down list select the data bits parity and stop bits of the PC port selected in Sim on PC Port Flow Control From the drop down list select the flow control of the PC port selected in Sim on PC Port Simulate on PC Port From the drop down list select the serial port on your PC that you want to use to transmit data in Simulation mode If this option 1s set to lt None gt any serial send and receive requests by the application are ignored If you are setting up more than one port assign a different PC serial port to each terminal serial port 6 5 2 Communications Window Settings Click Communications Window Settings to set up com munication preferences for the Communications Comm View window in Simulation mode 35 Communications Settings T Display as Hexidecinal I Wrap line on newline characters W Favor wrapping lines on word breaks T Show only transmitted data im Non prntable character Default l Space character Default gt Newline and carrage return Default 0792 Masimum butter size Default mea The default settings are generally adequate for most users but you can change any of the following settings Display as hexadecimal If this option is enabled while in Simulation m
153. ool_Persist yPos Tool_Persist width Tool_Persist height Call our MSG_INIT handler StartUp endfunc Since the location and size of an area object container is determined by the extent of the click and drag operation in Layout View this handler is necessarily more complex than the handler in the non drawable boilerplate code The x1 y1 and x2 y2 coordinates that are passed to the han dler as parameters indicate the locations of the initial click and release respectively at the end of the drag The handler calculates the position and size properties of the object based on the values of x1 y1 and x2 y2 It also sets the parent persists the changed properties and calls the MSG_INIT handler to complete the object initialization The boilerplate handlers should suffice for most objects and the code is easily modified to suit unusual circum stances Writing these handlers from scratch can be tedious and error prone For this reason using the boiler plate code as a basis for new object template designs is rec ommended 10 4 3 Adding Object Template Documentation AutoDoc is a Qlarity Foundry feature that automatically documents the object templates included in a workspace All libraries provided with Qlarity Foundry as well as func tions variables and APIs are already included in Object Documentation and the optional extra pop up Help see section 6 2 Layout Press lt F1 gt or s
154. ormal function The validation function can be explicitly called from other Qlarity functions if desired For example when the graph level property of a bar graph object is changed you need to redraw the graph at the new level Also values outside the range of the gauge should be clipped to a maximum or minimum value These can both be accomplished with a validation function for the graph level property Suppose that the property is an integer named graphlevel The validation function might look like the following func graphlevel newval as integer clip to the max or min value 1f newval gt maxval then newval maxval elseif newval lt minval then newval minval endif Now assign newval to level Note the use of strict assignment op graphlevel newval Now request this object to redraw rerender me endfunc Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 70 The Rerender function is a Qlarity API function see section 10 2 The Qlarity API Library that generates a MSG_DRAW message for the area of the object For array properties separate validation functions can be written for assignment of the entire array and assignment of individual elements of the array See section 2 12 4 Array Validation Functions and section 2 12 5 Array Element Validation Functions of the OptoTerminal Programmer s Reference Manual for more detail Validation
155. ottomRight const DefTempilarmtap All zones are at optimal temperature msg timetick 50 Oo false func SmallDelayiparm as integer returns boolean Es Layout View E Code View 43 247 ue that are based on the object template may be added to an application Object templates typically reside in libraries where they can be used in many different applications However templates can also exist in a normal workspace When templates are part of a workspace they appear at the bottom of the Object Tree when Code View is selected A template defines the properties variables and methods functions for a certain type of object The properties and methods in a template completely define the behavior of object instances that are created from the template Proper ties may also be assigned default values in the template These values are used if the object instance does not assign an initial value to a property Details on creating templates are provided in Chapter 10 Advanced Design Each object instance may be customized by changing the values of the properties and by overriding methods defined in the template A method override is a function defined Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 OptoTerminal Qlarity Foundry User s Manual in the object instance that replaces the method of the same name defined in the template for the specific instance only If the
156. ponse to gt dragging it around the object tree Note the purpose of this function is to gt allow you to attach to another gt container you should not change your gt parent property or call Tool Persist gt until you receive a MSG_TOOL_ATTACHED gt A MSG TOOL ATTACHED will be sent in gt response to an Attach API function call func ToolAttach attachTo as objre handles MSG_TOOL_ATTACH Attach me attachTo endfunc This function is called in response to gt calling Attach primarily in a handler gt for MSG _TOOL_ATTACH but possibly in gt other places as well_ func ToolAttached newParent as objref handles MSG_TOOL_ATTACHED Set our parent property to reflect gt who we are attached to and save parent newParent Tool Persist parent Save parent endfunc This function is called when the user gt created an instance of this template by gt selecting it from the object palette and gt dragging it in the layout view The handler for MSG INIT is not called gt automatically and if you want it gt called you should call it manually You should call Tool_Persist on all the gt properties that you set up in this gt message handler func ToolDragCreate parentObj as objref handles MSG_TOOL_DRAGCREATE parent parentObj Tool Persist parent Call our MSG_INIT handler Startup endfunc
157. r 10 Advanced Design in this manual to help you get started producing your own object templates Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 CHAPTER 10 ADVANCED DESIGN The ability to completely design custom objects for a user application is the crowning feature of the Qlarity program ming language This chapter provides information to help users design their own objects using Qlarity Advanced users are not bound by the selection of objects available in Qlarity and Opto 22 libraries As an advanced user you can design objects that best represent the data and user interface elements for a particular application For example if the OptoTerminal is replacing an existing con trol panel you can create objects that mimic the look and feel of the user interface elements on the old panel The variety of objects you can create with Qlarity is virtually unlimited This chapter introduces the Qlarity concepts that are crucial for object design including the following e Validation Functions e The Qlarity API Library e Exception Handling It also includes information on the following e Create a New Object Template e Guidelines for Designing New Object Templates Before proceeding you should be familiar with the con cepts presented in Chapter 8 Basic Design and Chapter 9 Intermediate Design and have some practice with Qlarity design at those levels In addition you sho
158. r a template click the template name in the Add Edit Templates dialog box then click Edit Icon The following dialog box is displayed Edit Template Icon Invert Fill white Fill black OF Cancel OptoTerminal Qlarity Foundry User s Manual The icon form is graphically represented as a grid Each square in the grid is an individual pixel On the grid draw the icon for the template using the following tools e Click in a pixel to fill it with black Right click in a pixel to fill it with white Drag to fill several consecutive pix els e Click Fill white to fill all pixels in the grid with white e Click Fill black to fill all pixels in the grid with black e Click ety 5 to move or offset the graphic in the grid y For example you can click _ Fill white then click l twice and click gt once to add side borders and click a twice and a once to add top and bottom borders e Click Revert to return the graphic to its original design e Click Invert to reverse the black and white pixels 5 1 3 Rename Template In the Add Edit Templates dialog box do the following to change an object template s name 1 Click the template name that you want to edit It is highlighted in blue 2 Click Rename Template 3 Type the new name over the old name 4 Click Close to save the change and exit 5 1 4 Remove Template In the Add Edit Templates dialog box do the following to r
159. r open the event in Event Builder your changes are reflected 8 4 6 Troubleshooting If you make a mistake while configuring an action an error message is displayed in red in the Description column of the action table Description Missing source proper AE If any error messages are shown you will be unable to click OK to save and exit the dialog box In some cases Qlarity Foundry may not detect the error until you click OK In those cases Event Builder remains open for you to correct the error After you correct the error click OK again If there are no more errors Event Builder closes and the event 1s configured If you cannot or do not want to correct the error click Cancel Event Builder closes and any changes you made are not saved Advanced users may click Edit in Code View to edit the object template code to correct any errors Errors must be corrected in Code View before you can exit or switch back to Layout View 8 5 Communication Objects The Common library common lib provided with Qlarity Foundry contains object templates that are programmed to send data to a computer or other compatible device through a serial or Ethernet port Once a communication object or objects is set up you can use Event Builder section 8 4 or EZObjects Appendix B to set up an event to send data out the port No programming is required 8 5 1 Serial Objects To use the serial port to send data add a serial
160. s option only applies to applications that use an external keypad not a keyboard Click Keypad Settings to con figure the keypad simulation Keypad Settings TT Key Repeat Repeat Delay 520 Repeat Rate i 20 a OptoTerminal Qlarity Foundry User s Manual Key Click Select this option to turn the audible key click on in Simula tion mode If selected you will hear a tone or beep when you click a key on the simulated keypad Key Repeat Select this option to turn the key repeat feature on If selected a key entry repeats when you click and hold down the mouse button on a key on the simulated keypad Repeat Delay If you selected Key Repeat enter the delay time in milli seconds that you want between when a key is pressed and when it begins to repeat automatically Repeat Rate If you selected Key Repeat enter the time in millisec onds that you want between each repeat when a key begins to repeat automatically Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 CHAPTER 7 DOWNLOAD SOFTWARE TO THE TERMINAL This chapter provides information to do the following e Configure Communications Port e Download a User Application e Download a BFF File e Upgrade the Firmware 7 1 Configure Communications Port To configure the communications port used to download user applications to your OptoTerminal select Download Application from the File menu The
161. s that are linked to an EZObject For example you can set up an EZCircle as a button that when pressed sends a text string to a text object and also sends the text string or other data out the communications port NOTE also see Event Builder Qlarity Foundry s Event Builder allows you to add event action functionality to any appropriate object Refer to section 8 4 Event Builder for more information The following image shows an EZImage s object properties including the properties required to set up an event Marne enabled parent poz PPOs transparent transparentcolor ezimage blink blinkrate event eventeourcecby everntsourcepro eventtargetobj eventtargelprop eventtargetyalue eventoby Marne enabled parent event eventeonrceobj eventsourceproaperty eventtargetobj eventtargelproperty eventtargetyalue eventobj String boolean objref integer integer boolean color bitmap boolear integer mageew obiret string objref string string ezevent String boolean objret ezeventtyp objret sting objret sting sting ezevent EZImage_1 true default Tr 48 false rgb magenta default falze ED IMage_ screen zcale_1 The following image shows an EZEvent s object properties ezevent_1 true default eznothing default default default default default empty B 1 Set Up an Event with EZOBjects To
162. s these libraries and your changes would be lost Rather you should copy the template code into your work space or a personal library e g mylib and make your modifications there Do the following to create a new object template based on a library object template 1 Click on the toolbar or select Add Edit Templates from the Edit menu and the Add Edit Templates dialog box is displayed You can also right click anywhere in the Templates branch of the Object Tree and click Add Edit Templates on the shortcut menu FE Add Edit Templates New Template Remove Template Rename Template Editar Send lempate to Library O Non Drawable Area Object e Container 2 Click New Template and the following dialog box is displayed Hew Template Wizard x Create a template ready to operate in larity Foundry 7 Create a completely blank template Create a template based on a pre existing library object Template name LabelBDF2 A LabelB DIF Cancel Based on 67 3 Select Create template based on a pre existing library object This option creates a new object template using the programming code from a library object you specify in the Based on box 4 From the Based on list box select the existing library object on which you want to base the new object tem plate 5 In the Template name box type a name for the new template Each templat
163. s to an object s code EN Click to add or remove a bookmark in an object s code at the cursor location Bookmarks make it possi ble to find a location quickly which is useful in objects with several lines of code Click to open the Add Edit Templates dialog box to add or edit an object template Refer to section 5 1 Add Edit Templates and to Chapter 10 Advanced Design for information on creating templates E Click to open the Edit Resources dialog box to add resources to or remove them from the workspace Refer to section 5 2 Edit Resources for informa tion i Click to open the Libraries dialog box to add libraries to or remove libraries from the workspace Refer to section 5 3 for information 11 gt Click to open the Qlarity Foundry Preferences dialog box to define the terminal s configuration and to enter Qlarity Foundry preferences Qlarity Foundry attempts to simulate the terminal s display area input type and so on as closely as possible Refer to Chap ter 6 Qlarity Foundry Preferences for information Click to identify the version of Qlarity Foundry you are running 3 6 Miscellaneous Bar The miscellaneous bar next to the toolbar contains the Lay out Scale and Outline All Objects functions in Layout View an error indicator in Code View and the Layout Scale in Simulation mode Select Misc Bar from the View menu to show or hide the miscellaneous bar functions Layout View Mi
164. sc Bar Layout scale 1 To change the scale of the work area click the drop down arrow and select the scale from the drop down list This function is also available in Simulation mode Outline all objects I Select this option to draw a line around all defined objects This is useful when you want to know the exact border loca tion of each object or when one or more objects were acci dently moved out of the work area Code View Misc Bar x o 2 2 2 2 2 2 E Mo Error This box indicates 1f the selected line of code contains an error 3 7 Object Tree The Object Tree contains two branches e Globals e Templates The Globals branch is always visible the Templates branch 1s only visible in Code View The illustration below shows both branches of the Object Tree Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 12 Object Tree ala Globals eRe ai ExEsceptionDisplay 1 E af ContrastDarker2 E af ContrastD arker_1 af ContrastLighter E af ContrastDarker 7 a lsMoisy e a af Secure Wiarn AMP Af y af Tempiwam BMP Oo y EWEN d LabelBDF_ 2 ai CursetT emp E d SetNumk eypad ai SetT empLabel HE g MainForm A ai MakeTempz ifs Templates A Temperature Update Each object instance listed in the Object Tree has an icon that shows the type of object BDF label button 3D event timer form line etc The objects are listed in Z order see App
165. set up an event using EZOBjects do the following 1 Add the EZObject that will be used to perform the event e g EZCircle EZImage 2 If you want the object to perform more than one event e g a screen press and the screen release or if you want the event to send data to multiple objects add the applicable number of EZEvent objects Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 86 For example if you want to define screen press and screen release events add the EZObject then add one EZEvent object You can define the screen press event in the EZObject properties and the screen release event in the EZEvent object properties which you will link to the EZObject 3 Define the following in the object properties of the EZObject and any EZEvent objects linked to it e The event that will trigger the action specified in the event property e The source of the data to be sent using one of the fol lowing methods A source object and property specified in the eventsourceobj and eventsourceproperty properties The data to be sent typed in the eventtar getvalue property e The target object and property to receive the data e g text object gauge object serial object etc specified in the eventtargetobj and eventtarget property properties Following are the properties required to define an event eventobj This property is only req
166. set up for intermediate level programming For more information on the Programmable Objects library refer to Chapter 9 Intermediate Design Create workspace like the last one created This option appears if you have previously created a work space Select this option to create a workspace containing the same libraries and resources that were in the last work space created Click the workspace type that you want to use and click Finish or Next depending on the workspace option you selected If you click Next the following dialog box is displayed Select any additional items to add to the workspace i x Add additional items to your project Note Some objects require that at least 4 Include a default BDF raster font one font or bitmap be included in the M Include a default TrueType tm font workspace Creating such an object I Include a default bitmap without including Al calas da causez an error For additional fonts an Include extra BDF raster fonts bitmaps select Edit Resources from the Edit menu i Include an error handling object Include a screen blanker burns off backlight when unit is inactive to save power T Include a screen saver will also turn off backlight to conserve power Select additional object libraries Mo library selected 2 corner lib JEnhancedT ext lib hi exexcephiondisolay lib Jexscreenzawer lib modus lib Tour project is now ready Sel
167. t bin a mc biri a mtg bir Look irr File name Files of type Clarity firmware binary files bir Cancel 4 Select the firmware software file to be downloaded and click Open A progress graph tracks the download Messages in the Results box indicate whether the download was suc cessful When finished the new firmware version is shown in the Results box 25 Download application to unit Download pp download size 24601 Flash required 64 kbytes Download application Download other BFF Serial Ethemet Port Com Baud rate 115200 Data Format en Send sting over senal connection nt h Induce set unit time bootloader In Apploader gt NOTICE recerved request from kernel to enter bootloader Entering G5 Bootloader 1 07 4 ln Bootloader Bootloader entered Received new kernel 286626 bytes oe Clear results box Close Windows If Open serial port whenever this screen is shown a 7 4 5 Set Unit Time Use the Set Unit Time function to set the real time clock on the OptoTerminal as follows Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 OptoTerminal Qlarity Foundry User s Manual 41 1 The terminal must be in download or develop The message lt Setting Time gt is displayed in the mode If necessary set up the OptoTerminal for down Results
168. t Windows application Undo Select this option to undo the last action performed In Lay out View the undo buffer is cleared each time the work space is compiled In Code View the undo buffer is cleared each time you view the code of a different object Redo Code View only Select this option to redo the most recent undone action This option is only available after you have selected Undo in Code View Add Edit Templates Select this option to open the Add Edit Templates dialog box to add or edit an object template Refer to section 5 1 Add Edit Templates and to Chapter 10 Advanced Design for information on creating templates OptoTerminal Qlarity Foundry User s Manual Edit Resources Use this option to open the Qlarity Resources dialog box to add resources to or remove them from the workspace Refer to section 5 2 Edit Resources for information Edit Libraries Use this option to open the Libraries dialog box to add libraries to or remove libraries from the workspace Refer to section 5 3 for information Find Code View only Select this option to find code in the displayed object instance template or workspace Enter the characters or code you want to find and click Find Next To find only characters matching the entered case upper or lower select Match Case To search through all object instances and templates in the workspace select Entire Workspace Replace Code View only Select th
169. the endfunc keyword on its own line The parameters appear as new variable declarations see section 9 5 1 without the dim keyword Each parameter is separated from other parameters by a comma Since this is a message handler there are restrictions on the parameters and return type for this function The allowed parameters and return type depend on what message is being handled There are no restrictions on the name of the function except those imposed by Qlar ity See the OptoTerminal Programmer s Reference Manual Chapter 3 Messages and Message Handler Prototypes for more details OptoTerminal Qlarity Foundry User s Manual Also a handles statement is needed on the line fol lowing the function declaration The statement begins with the keyword handles followed by the name of the message that is being handled by the function For example the following code declares a new event handler named timer that handles MSG_TIMETICK As explained in the OptoTerminal Programmer s Ref erence Manual Chapter 3 the handler takes no param eters and does not return a value func timer handles MSG TIMETICK endfunc 4 Fill the body of the handler on lines between the han dles statement and the endfunc statement with the Qlarity code to implement the desired function If the handler returns a value be sure to include a return statement For more information see the OptoTerm
170. the Tool_Persist API function after the parent property has been updated The Tool_Persist function should be called after any property update in a tool message handler The last handler included in the non drawable boilerplate code is the MSG_TOOL_DRAGCREATE handler When an object instance is created by selecting the template on the Object Palette and dragging it into the Layout View display the object receives a MSG_TOOL_DRAGCREATE mes sage from Qlarity Foundry This allows the object to initial ize itself properly For a non drawable object the only parameter passed to the handler is an objref referencing the parent object The handler updates its parent property and calls Tool_Persist Note that the MSG_INIT handler is called from the handler to complete the object initialization The tool message handlers for containers and area objects are identical In addition to the handlers described above the boilerplate code for these object types includes handlers for the MSG_TOOL_MOVE MSG_TOOL_GETHAN DLES and MSG_TOOL_MOVEHANDLE messages Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 OptoTerminal Qlarity Foundry User s Manual Also the MSG_TOOL_DRAGCREATE handler is larger and more complex than the handler for non drawables The MSG TOOL ATTACH and MSG TOOL AT TACHED handlers are identical to the handlers in the non drawable code so they are omitted here The code for the MSG_TOOL
171. the end of the name Entry Type From the drop down list select the type of entry e Source object template e Bitmap resource e BDF font resource e TT font resource Filename If the library entry is a resource e g bitmap or font enter the location of the resource file Click Browse to find the file if necessary Click OK to continue If the library entry is a source object template a message is displayed explaining that Qlarity Foundry will insert a blank entry in the library To enter the programming code for the object template select the new entry and click Edit Entry You can also add new object templates that you have already created with the Send Template to Library option in Add Edit Templates see section 5 1 5 for information 5 3 4 Edit Natives In addition to Native API functions as described in the Pro grammer s Reference Manual the standard Natives library Natives lib contains several utility functions written in the Qlarity language To make these functions available type the following in the Globals section of your workspace library standard source lt entryname gt lt entryname gt is the name of the library that contains the additional API functions you want to use To determine the entry in which a function resides locate the function in the Object Documentation Help file Each utility function in the library begins with the underscore _ character Click the E
172. the error type and respond appropriately to each type of anticipated exception If the error type is not what was anticipated the exception should be rethrown using the Rethrow API function This gives higher level exception handling code the opportunity to handle the exception if desired NOTE GetException Ordinarily GetException should be called only ONCE in an on error block In a global MSG_ERROR handler GetException is typically called repeatedly until all excep tions have been retrieved Details on the syntax of check error on error can be found in section 2 15 Exception Handling in the Opto Terminal Programmer s Reference Manual 10 4 Create a New Object Template To create a new object template in your application do the following 1 Click on the toolbar or select Add Edit Templates from the Edit menu The Add Edit Templates dialog box is displayed Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 FE Add Z Edit Templates Template Type iow New Template Remove Template Rename Template Eqitlicon Send empl ate to library Non Drawable Ares Object Eonta ner You can also right click anywhere in the Templates branch of the Object Tree and click Add Edit Tem plates on the shortcut menu 2 Click New Template and the following dialog box is displayed Mew Template Wizard E A Create a template ready to operat
173. the handler to change the currently selected grip if desired Notice that the boilerplate code reassigns handleNum when the object is dragged inside out 1 e a grip at the bottom is dragged above the top of the object or a grip on the right edge of the object is dragged past its left edge Finally the container area object boilerplate code for the MSG_TOOL_DRAGCREATE handler is as follows The following function is called when gt the user created an instance of this gt template by selecting it from the object gt palette and dragging it in the layout view The handler for MSG INIT is not called gt automatically and if you want it gt called you should call it manually You should call Tool_Persist on all the gt properties that you set up in this gt message handler x1 yl are the gt coordinates that the user started his gt drag and x2 y2 are the coordinates gt that the mouse was released func ToolDragCreate parentObj as objref gt xl as integer yl as integer x2 as gt integer y2 as integer handles MSG_TOOL_DRAGCREATE if x2 x1 then xPos x2 width x1 x2 1 else xPos x1 width x2 x1 1 endif if y2 lt y1 then yPos y2 height yl y2 1 else yPos y1 height y2 yl 1 79 endif parent parentObj Save the properties that we just set Tool_Persist parent Tool_Persist xPos T
174. the template click S or select Compile from the File menu to compile the workspace Any errors in the new source code are iden tified by messages in the Error Messages box If no errors are present the compiled workspace is returned to Layout View Notice that the Object Palette contains a default icon representing the new template 12 To edit the icon or change the name click on the toolbar or select Add Edit Templates from the Edit menu Click the template name in the Add Edit Tem plates dialog box then click Edit Icon Refer to section 5 1 2 Edit Icon for more information 10 4 1 New Template Boilerplate Code The new template boilerplate code can be used as a founda tion for building new objects Using the boilerplate code can greatly simplify the creation of new objects This section provides an overview of what the boilerplate code is and the functionality it provides The actual boilerplate code gener ated by Qlarity Foundry is continually being improved and may differ from the code described in this section The functionality however is mostly the same Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 OptoTerminal Qlarity Foundry User s Manual Qlanty Foundry Hew Workspace glarity 73 File Edit View Tools Help O tae ll amp Ez Bal S mM 2 2 al No Error Object Tree OS Eg a a Globals ERR oe adj ExceptionDisplay E a ai Screen lanker E
175. tion on library and workspace object templates as well as func tions variables and APIs in the workspace Documentation is included for all libraries provided with Qlarity Foundry Advanced users can add documentation for object templates they create refer to section 10 4 3 Adding Object Tem plate Documentation for information To use Object Documentation in the Qlarity Documenta tion index double click the item for which you want to view Help You can also type a keyword in the text box to search for an item then double click the item in the key word list Show Qlarity Foundry Help Shift F1 Select this option or press lt Shift gt lt F1 gt to view the Qlar ity Foundry Help file The Help file provides the informa tion in this Qlarity Foundry manual so that you can access 1t online while you are working in Qlarity Foundry Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 0P TO 6786 10 Show Qlarity Language Help Ctrl F1 Select this option or press lt CtrI gt lt F1 gt to view the Pro grammer s Reference Help file The Programmer s Refer ence provides information on the Qlarity programming language and message handling system detailed informa tion on the syntax to write programs in the Qlarity language descriptions of system messages a Qlarity API Applica tion Programming Interface function reference and other information on programming in the Qlarity language About
176. ts to simulate the terminal s display area input type and so on as closely as possible Refer to Chap ter 6 Qlarity Foundry Preferences for information Click to identify the version of Qlarity Foundry you are running 3 5 2 Code View Toolbar Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 OptoTerminal Qlarity Foundry User s Manual O Click to start a new workspace Refer to section 4 1 for information Click to open an existing workspace Refer to section 4 2 for information Y i Click to save the current workspace Refer to section 4 4 for information E Click to compile the current workspace into the for mat required for a user application A workspace also must be compiled to properly display in Layout View Refer to section 4 5 for more information to Click to open the Download Application dialog box Refer to Chapter 7 for information Es Select code then click EJ to cut the selected code from the workspace The code remains in the Win dows buffer until replaced by other cut or copied code Select code then click to copy the selected code The code remains in the Windows buffer until replaced by other cut or copy operation E Click to place cut or copied code into a workspace or another Windows application at the cursor position Click to go to the next bookmark in the displayed object Use the Toggle Bookmark tool to add book mark
177. tup 8 7 Save and Compile a Workspace 8 7 1 Save a Workspace You should save your workspace often while you are work ing on it to prevent losing work in the event of a computer lockup or power failure To save a workspace click fA on the toolbar or select Save Workspace from the File menu For more information on saving a workspace refer to section 4 4 8 7 2 Compile a Workspace You should compile your workspace periodically while you are working on it to properly display the changes in Layout View Compiling is also required before you download a user application Click Ea on the toolbar or select Com pile Workspace from the File menu to compile the current workspace into the format required for a user application OptoTerminal Qlarity Foundry User s Manual If the compile is successful the program displays the work space in Layout View If any errors occur during the com pile the program switches to Code View and the error messages are displayed in the Compile dialog box 8 8 Download a User Application Before you can download a user application to the OptoTer minal you need to configure communications in Qlarity Foundry and at the terminal and prepare the terminal for download For information on setting up communications refer to section 7 1 For information on preparing the terminal for downloading refer to section 7 2 1 For information on downloading a user application to the terminal refer to se
178. u want your Qlarity application to do e Determine which objects you need Some objects will be used for events others will perform the actions associ ated with the events Place all of the objects in the work space e Outline each event action association e g when a but ton is pressed an action or actions occur e Use Event Builder to assign actions to each event 53 8 4 2 Event Builder Dialog Box In the Layout View select an object in the workspace for which you want to set up an event The properties and events associated with the object are displayed in Object Properties Click the Events tab to see the events associated with the selected object Properties Events Click el H andlePress ES H andleRelease ES Click Bl next to an event to open the Event Builder dialog box to assign actions to the event Event Builder Qlarity_com Click event Action EA E 1 Click to add action Select what type of action you wish to add from the drop down list in the grid Once you have selected a general action type you may customize what exactly occurs during that action Cancel Edit in Code View The Event Builder dialog box contains the action table that lists all actions assigned to the selected event and the action configuration section that contains options to set up each action Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 54 Event B
179. uilder ListBox SelChanged event al x faction Description Set Property Set Tachometer s value property to selected 1 Action Table Action Configuration Property to Set Set to this Yalue Object Tachometer ast Use the value of this object property Property vae H Object Globals y Property py Edit in Code View A Y Descriptions Use this explicit value selecte el Set an object property Use this action to set an object property or a global variable You can either set it to a specific value or copy the value of another property or variable Action Table The action table lists all actions configured for the selected event Each action is on a separate line in the table To modify an existing action click the action in the table To add a new action click the last line in the table labeled Click to add action and select the action from the drop down list Then modify or set up the selected action in the action configuration area Action Configuration After you select an action in the action table applicable options are displayed in the action configuration area to set up the action Click OK to accept the event as currently configured If any configuration contains an error a message is displayed NOTE EZObjects Qlarity Foundry also includes an EZObjects library ezlib that contains object templates with event functionality pro gramm
180. uired if you are linking EZEvent objects to the EZObject It allows an object to perform mul tiple actions from a single event or to handle more than one event In the EZObject s property click the drop down list and select the name of the EZEvent object or 1f using more than one EZEvent object any one of the EZEvent objects to be linked If linking only one EZEvent object you do not need to enter anything in this property for the EZEvent object If linking more than one EZEvent object in the first EZEvent object select the name of another EZEvent Object to be linked In the next EZEvent object select the name of another EZEvent Object to be linked and so on until each EZEvent object is linked to another You do not need to enter anything in this property for the last linked EZEvent object The order in which EZEvents are linked does not matter OptoTerminal Qlarity Foundry User s Manual For example if you are defining an event that requires five objects one EZOjbect and four EZEvent objects link them together as follows In the eventobj property of the EZObject select ezevent_1 in ezevent_1 s property select ezevent_2 in ezevent_2 s property select ezevent_3 in ezevent_3 s property select ezevent_4 When the event that triggers the action occurs the message announcing the event is passed from the EZObject to ezevent_1 which pro cesses its defined event if appropriate and passes the mes sage to ezev
181. uld review Chap ter 1 QTERM G70 G75 Software Fundamentals and Chapter 2 Qlarity Language Syntax of the OptoTerminal Programmer s Reference Manual as these cover basic information needed for programming in Qlarity 10 1 Validation Functions Validation functions are special functions that are closely associated with object properties or global variables When a property is assigned a value using the validation assign ment operator the associated validation function is implicitly called and passed the new value as a parameter This facility allows objects to appropriately respond to property changes Validation functions are also called when certain API functions such as Val and SetObjProp are used to assign a value to a property Validation functions are also useful for assuring that the new value is valid or within an appropriate range hence the term validation function To associate a validation function with a property the func tion must have the same name as the property In almost all cases 1t must take a single parameter of the same data type as the property The name of this parameter can be any legal Qlarity variable name but it is good style to use a common name for all your validation functions see section 10 5 Guidelines for Designing New Object Templates Valida tion functions should not have a return value Apart from these restrictions the function 1s written and behaves as a n
182. ursors and a boolean variable named closed The handler places values in these parame ters to indicate the location and style of the resize grips The handler first creates and initializes an array of type Gui Cursors This is an enumerated type whose values indicate the style of the corresponding resize grip The selected style determines what cursor is drawn when the mouse passes over the resize grip and the restrictions on drag movement for the resize grip See section 3 7 Tool Messages in the OptoTerminal Programmer s Reference Manual Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 0P TO 6786 78 OptoTerminal Qlarity Foundry User s Manual The xCoords and yCoords arrays receive the horizontal and newWidth width dx vertical locations for each resize grip respectively The size elseif handleNum 4 then of the three arrays xCoords yCoords and cursors deter newWidth width dx mines the number of resize grips that will be drawn All Be oe SE ee ee three arrays should be sized to the same value The boiler SARETE aa al ENUM Ss OO f i i newHeight height dy plate code sizes these arrays to 8 so 8 resize grips will be elseif handleNum 6 then drawn for the object The code then locates the grips on the a f newX xPos dx perimeter of the object at locations calculated from the posi ee eee eee tion and size properties newHeight height dy else Qlarity Foundry draws li
183. view the parts of the workspace that are not visible Click EJ then click anywhere in the work area and hold the mouse button as you drag in the direction you want to view When the section you want to view is visible release the mouse button The pointer remains in scroll mode until you click a different icon or exit the workspace You can close the Object Palette by clicking the Close but ton xj or you can show or hide it by clicking Object Pal ette on the View menu 15 3 11 1 Add a New Object Instance Do the following to add a new object instance from the pal ette 1 Click the icon of the object instance you want to add 2 Move the mouse pointer to the work area The pointer changes to a cross hair 3 Click and hold the mouse button and drag the mouse to draw a rectangle in the work area Then release the mouse button Some objects have a default starting size and shape so the size of the rectangle doesn t matter only its posi tion in the work area The size of other objects such as a line or rectangle is initially determined by the size of the rectangle you draw NOTE add multiple instances of the same object type To add more than one instance of the same type of object press and hold the lt Shift gt key when you click the object icon The object type remains selected and you can just click and drag in the workspace to add objects until you release the lt Shift gt key 4 After you add an obje
184. w eventsourceobj obiret eventsourceprop string eventbargetoby obiret eventtargetprop sting eventtargetvalue string eventoby ezevent If El appears in a property field when you select the prop erty a drop down list of property options is available Click to display the drop down list and then click the option you want to use If the property is a workspace resource bitmap image font sound or binary data or a color a Select button is dis played next to the drop down arrow If the resource or color you want is not in the drop down list click to open the Qlarity Resources dialog box or the Select Color palette Select a resource or color and click OK to add it to the workspace and to the property s drop down list Select the resource or color from the drop down list to place it in the property Refer to section 5 2 Edit Resources for infor mation on the Qlarity Resources dialog box Refer to section 8 3 3 1 Select Color for information on selecting a color NOTE selecting a parent object If you want an object instance to be the child of a parent object placed in a container object from the parent property drop down list select a container object and the object instance is automatically moved and attached to the selected object in the Object Tree To move an object to the root container click default in the drop down list 8 3 3 1 Select Color If color
185. w information to disk NOTE button labels The labels on the buttons used to edit resources change to match the resource tab you selected For example you click New bitmap to add a bitmap image New BDF font to add a BDF font and New audio resource to add an audio file The label on the Rename button changes to the name of the resource you selected to rename 5 2 1 Add a Resource In the Edit Resources dialog box do the following to add a new resource to the workspace 1 Click New resource type e g New BDF Font and an Open dialog box appears Resource files in the default folder are listed change folders 1f necessary 2 Select the resource file or files that you want to add NOTE select multiple files To select multiple files that appear consecutively in a list press and hold lt Shift gt then click the first and last file in the group you want to select To select multiple non consecu tive files press and hold lt Ctrl gt then click each file that you want to select 3 Click Open The resource is added to the list of resources When you add a resource it is given the name of the file by default The resource name is the name that appears in Object Properties for you to select the resource for an object instance For information on changing the name refer to section 5 2 3 below OptoTerminal Qlarity Foundry User s Manual 5 2 2 Preview Resources When you select a resource in the list
186. y Foundry and describes Qlarity Foundry Installation This chapter covers the installation and setup of the Qlarity Foundry software Getting Started This chapter outlines Qlarity Foundry s features and functions Workspaces This chapter explains how to start open close save and use workspaces in Qlarity Foundry Templates Resources and Libraries This chapter explains how to add and edit templates advanced func tion edit resources and edit libraries Qlarity Foundry Preferences This chapter explains how to set up and define your terminal settings for Qlarity Foundry and enter Qlarity Foundry preferences Download Software to the Terminal This chapter explains how to configure the terminal communications port download user applications and BFF files and upgrade new firmware Basic Design This chapter explains how to get started using Qlarity Foundry and covers user application design basics Intermediate Design This chapter provides instructions a step beyond design basics Advanced Design This chapter provides instructions for advanced user application design Glossary of Software Terms This appendix provides definitions of the terms used in Qlarity Foundry EZObjects This appendix describes and explains how to use the objects in the Qlarity Foundry EZObjects library EZObjects contain the programming needed to respond to an event Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 MANUAL
187. y also be manipulated at runtime using the Z order primitive API functions Also see Object Hierarchy Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 APPENDIX B EZOBJECTS LIBRARY The EZObjects library ezlib contains object templates that have event functionality programmed into them All EZOb jects contain the programming needed to respond to an event e g touch screen press timer action etc The response is a transfer of data from a source to a target object You set up an event for an EZObject by entering or selecting the appropriate properties in Object Properties No additional programming is required For example you can set up an EZCircle or EZImage as a button that when pressed on the screen triggers an action such as changing text switching screens on the terminal display updating a simulated gauge or sending data out the serial or Ethernet port If you want an object to respond to multiple events e g screen press and then screen release or if you want an event to send data to multiple objects you must add addi tional objects called EZEvent objects By linking one or more EZEvent objects to an EZObject you can expand the EZObject s event processing capabilities You link EZEvent objects to EZObjects using the eventobj property explained later in this section An EZEvent object cannot stand alone to define an event EZEvents contain only event related propertie
188. y also type in a value Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 OptoTerminal Qlarity Foundry User s Manual You can close Object Properties by clicking the Close but ton X Normally however you will want to keep Object Properties open 3 11 Object Palette The Object Palette contains a tab for each library in the workspace as well as an All tab and an Other tab Each tab has icons for all of the object templates in the library FEE A Enh p ee Pore wt Le Aft y e POLY POLY du E mo LIHE GON sq di ei ee a E 1414 E ER sie LA A El Ed En Es Eu pA j Click a tab to select an object from the specified library The All tab contains icons for all objects available to the workspace from all of the libraries in the workspace The background color of each icon identifies the library in which the object can be found The Other tab contains objects from various small libraries For more information on object libraries refer to section 5 3 Edit Libraries Move the mouse pointer over an icon to display the object s name and description Click Ki to place the mouse pointer in select mode In this mode click an existing object to select 1t The pointer remains in select mode until you click a different icon Click to place the mouse pointer in scroll mode If the layout scale is larger than the work area use the scroll mode to
189. y does not have knowledge of the implementation of a Qlarity object the object template must implement handlers for several tool messages to work prop erly in Qlarity Foundry These messages are generated by Qlarity Foundry when the user interacts with the object in Layout View For example when an object is selected it should display a series of resize grips to allow the user to resize the object by dragging the mouse When the resize grips are dragged the object should respond accordingly Requiring each object to implement its own Layout View behavior allows you to extend the functionality of Qlarity Foundry in unique and powerful ways This power and flex ibility comes at the price of some complexity in writing handlers for the tool messages Fortunately the boilerplate code is sufficient for most objects This section describes the implementation of the tool han dlers in the new template boilerplate code The tool mes sages are explained in detail in section 3 7 Tool Messages of the OptoTerminal Programmer s Reference Manual Since a non drawable object is not visible on the display in Layout View its handler methods for tool messages are small and straightforward The code for the handlers is as follows Opto 22 Fax 800 832 OPTO 6786 Web www opto22 com Phone 800 321 O0PTO 6786 76 if TOOL This function is called by Qlarity gt Foundry when you change the attachment gt of an object i e in res
190. yed Qlanty Foundry Preferences Terminal Layout Editar Compile Simulation Input T Keyboard TF External Keypad Select Y TouchScreen Display Setup Dimensions te Landscape Portrait Grayscale fe Color Tabs are available to define your terminal s display to define the layout of the Qlarity Foundry work area to set up the code editor and to set up compile defaults as described in the following sections 6 1 Terminal Click the Terminal tab shown above to define the follow ing options on your OptoTerminal s display NOTE Simulation mode You cannot modify the settings in this tab in Simulation mode 6 1 1 Display Setup Dimensions From the drop down list select the display dimensions in pixels of your terminal model The OptoTerminal G70 has a 320x240 pixel display and the OptoTerminal G75 has a 640x480 pixel display Refer to the specifications for your terminal for more information Landscape Portrait A terminal may be mounted in Landscape longest dimen sion 1s horizontal or Portrait longest dimension is vertical mode Click the applicable mode for your terminal Grayscale Color Click the applicable color mode of your terminal Gray scale or Color 6 1 2 Input Keyboard External Keypad TouchScreen Click the input mode or modes that are supported by your terminal and that you plan to use If you select External Keypad click Select to select an exter

Download Pdf Manuals

image

Related Search

Related Contents

    ALTAIR 2X  5 機能の設定方法  AMB-289 CONSIGNES DE SECURITE (FRANCAIS)  Ariston - microGENUS  Miller Thesis - Center for Quantum Devices  Manuel d`utilisation  

Copyright © All rights reserved.
Failed to retrieve file