1. Download EXE file to your PC (not to PDA/Phone!).
2. Make sure that Microsoft ActiveSync is installed on the PC. (Windows Vista users: make sure that Microsoft Windows Mobile Device Center is installed)
3. Connect PDA/Phone via cable to your PC.
4. Run the downloaded EXE file on the PC to start installation.
How to install CAB files:
1. Copy CAB file to your PDA/Phone.
2. Click on the CAB file on your device to install the program.
How to install ZIP files:
1. Download ZIP file to your PC and extract content.
2. You will get EXE or CAB file. Follow the above instructions.
FlexIT is a fast and easy to use script based language allows you to build applications for Pocket-PC without having to learn a programming language.
Nothing in this publication may be copied and / or published by means of print, microfilm, sound tape, electronic or in any other way as well as stored in a retrieval system without preliminary written authorisation by the publisher.
Although this manual was made with great care, the author and the publisher do not accept any form of responsibility for damage resulting from possible errors and / or imperfections.
Contents
1 INTRODUCTION 1 2 HOW DOES FLEXIT WORK? 2 3 LAYOUT OF THE EVENTS GENERATED BY FLEXIT 3 4 LAYOUT OF A FLEXIT SCRIPT LINE 4 5 THE SPECIAL EVENT "FLEXIT.FLEXIT.INIT" 5 6 USING REGISTERS 6 7 USING OBJECTS 7 8 DATABASES 8 9 THE DL-FILE. 10 9.1 THE LAYOUT OF A DL-FILE. 10
History. During the last few years, PDA’s (Personal Digital Assistant) are advancing rapidly. A growing number of business people are using the small, compact and powerful hand computers. However, the software development tools progress relatively slow. One of the reasons for this is the fact that these devices use different operating systems than a standard PC.
In order to give the users of WindowsCE® PDA's the possibility to realise their specific software demands, Veridex BV developed a “tool” which allows building small to middle size programs easily. This tool is called "FlexIT".
FlexIT is a script language. This means that FlexIT is a kind of programming language in which the focus lies on the simplicity for the programmer. Instead of making complicated programs it is possible to put a lot of functionality in a program using just a few commands. The well known windows of the Windows® operating system can be created easily by just defining the properties (like length, height and position) of the window. The main goal while creating FlexIT was to make writing programs (applications) available to people with no programming knowledge.
What is expected from the reader? The reader is expected to have some general knowledge of the Windows® environment and operating system. Terminology like window, button and clicking must be clear.
What does this manual cover? The first eight chapters of this manual will discuss the construction and operation of the FlexIT script language. After that the available objects and functions of the FlexIT script language are discussed in chapters 9 and 10.
2 How does FlexIT work?
FlexIT is a script language based on a “event driven” methodology. The basis of this methodology is that a specific function is only executed after a specific event has occurred. The event can be started by the user, the operating system or by externally connected devices.
A script is a text file containing commands, which can be interpreted by a program (FlexIT) in order to execute specific functions from its library. A function is a small part of a program with performs a specific task. For example the function for showing a window or the function for playing a sound file. All FlexIT functions can be found in the function library. An event is an action that takes place. For example clicking a button and closing a window are events.
FlexIT makes use of two different kinds of files, namely DL-files (Definition List) and a script file. The DL-files contain a description of all windows and their linked window objects (like buttons and input fields) from which a user may start events. The script file contains a description of the functions that should be performed if a specific event occurs.
By defining distinct names for all events and functions the programcode (the script) that has to be written by the user stays clear and easy to read.
The layout of the DL-files and the script file are explained in separate chapters, but in order to give you a general idea you will find a short example below.
Example:
Suppose we want to make a simple program that plays a sound file after you push a button. In FlexIT writing this program will look like this:
The first step is to define (by using a DL-file) a window on which a button is shown. The name we give this window is "winMain" and the name of the button is “butPlay". This will result in a DL-file named "WINMAIN.DL", in which the definition of the window is described.
After FlexIT is started, a window will appear with a button. Now the user may click on the button.
By clicking the button an event will be started. FlexIT will name this event “winMain.butPlay.Click” (the syntax of this name is discussed later in this manual). The only line that has to be written in the script file contains the name of the started event and the function, which should be executed if the event is occuring (the guidelines about how to do this will be described in another chapter). In our example the action that should be performed is playing the sound file so the function for playing a sound file needs to be executed. The line entered in the script file looks like this:
TASK:winMain.butPlay.Click;F_Sound("BEEP.WAV")
Writing a program using the FlexIT script language is very easy. By making the available functions very powerful, most functionality can be reached by a relatively few script lines.
The advantage of the “event driven” methodology of FlexIT is that the programs are built easily by writing the desired functionality in the DL-files and the script file.
3 Layout of the events generated by FlexIT
Whenever a user clicks on a button or enters text in an input field FlexIT will generate an event that can be referred to in the script. The name of an event is formatted like this:
. .
• Name of the window This is the name of the window in which the user clicked on a button or entered new data.
• Name of the object This is the name of the object the user performed the action on (for example clicking a button).
• Event This is one word describing the action performed by the user. All events are predefined. All events are descibed in the description of the DL-files because the events depend on the object the user performed the action on.
Example:
A user clicks on the button "butPlay" in window "winMain".
The name of the window in which the action is performed is “winMain”. The name of the button object on which the action is performed is “butPlay”. The description of the button object (BUTTON) indicates that clicking the button will result in a “Click” event.
In this case the name of the event will be "winMain.butPlay.Click".
4 Layout of a FlexIT script line
All script lines are stored in a file called "SCRIPT.TXT". The syntax of a script line looks like follows:
TASK : ;
• TASK This is a reserved word an must be put in front of each line in the script.
• The name of an Event This may be the name of an event generated by FlexIT but also the name of an event generated by a function (see the description of the functions for more detailed information).
• A function call This is the name of the function that should be called followed by the parameters passed down to it. Chapter 10 contains a list of all available functions.
Example:
The line in script.txt in order to play a sound file after a button is clicked looks like this:
TASK:winMain.butPlay.Click;F_Sound("BEEP.WAV")
In the above line the event is called “winMain.butPlay.Click”. The called function is “F_Sound”. The sound file “BEEP.WAV” is passed to this function.
5 The special event "FlexIT.FlexIT.INIT"
Whenever a FlexIT program is started a special event will start automatically. This special event is called "FlexIT.FlexIT.INIT". Even if this event is not the first event in your script it will be the first event that is executed after start-up. Starting with this special event is necessary because otherwise FlexIT does not know where the program, described by the script file, should start.
Example:
Suppose the program should start using the window "winMain", than the special event will look like this:
If you do not use the special event in your script the program will immediately end after it is started.
6 Using registers
While developing an application it is helpful if it is possible to store data temporary. For this reason FlexIT provides the programmer with registers. Registers are no more than predefined variables (memory locations). Twenty registers are available in FlexIT. By using the function “F_SetReg” data is stored in a specific register. The data from a specific register is read using the function “F_GetReg”. The name of a register consists of the letter R followed by an underscore and the register number (between 1 and 20).
This example will show a window with the question "Are you sure?". The answer to this question ( 1 or 0; see description of "F_GetYesNo") is stored in the register R_1.
7 Using objects
As discussed earlier, the windows and the objects linked to these windows, like buttons, list boxes and labels, are defined in the DL-files. Several functions in the FlexIT library make use of these window objects as a passed down parameter. In order to be able to refer to a specific window object the following naming syntax is required:
O_ .
• O_ Indication that the name belongs to an object
• Window Name The name of the window on which the object is displayed.
• Object Name The name of the object.
Example:
Referring to the object "butPlay" on window "winMain" look like this:
O_winMain.butPlay
8 Databases
In many applications it is necessary to gather and store a notable amount of data in order to be able to consult it later on. For this reason FlexIT is provided with the possibility to use databases. In a database data can be stored, updated and consulted easily.
A database is a collection of data, which is arranged in several parts namely: tables, records and record fields. The connection between these parts is as follows:
• A database consists out of several tables. For technical reasons the WindowsCE® operating system only allows 1 table for each database.
• A table consists out of several records. In principle a record is one line in a table and a table may consist out of several lines. The conformity between the separate records is that they normally can be classified in the same category. Because of this the name of a database table in general is derived from the category in which the records can be placed. Examples: - A ClientTable is a table with information on clients. Each record represents the information for one client. - An ArticleTable is a table with information on articles. Each record represents the information on one article.
• A record consists out of several record fields. One record (line) can be divided in to several fields. The connection between the fields is that they all contain information about the same item. Examples: A record from the ClientTable consist of the fields: Name, the name of a client Address, the address of the client Telephone, the telephone number of the client
A record from the ArticleTable consist of the fields: Number, the article number belonging to an article Name, the name of an article. Description, the description of an article Price, the price of an article
• A record field contains the actual information The actual data of an item is stored in the record fields of a record.
An example of an article table:
Number Name Description Price A001 HD20GB 20 Gb Harddisk 300,- A002 900P 19" Monitor 500,-
By using a database object FlexIT provides you with the possibility to easily display and change the data stored in a database table. You only have to enter the name of the table you want to use, the fields from a record you want to see, how you want to scroll through the records in a table and how you want to add, delete or update the records in the table.
As discussed earlier, a record consists of several fields. By using a database object you are able to connect these fields to the objects (window objects) visible on the screen. Using the database object also gives you the possibility to define the way you want to scroll through the records in a table. While walking through the records in the table (selecting one record at the time) the contents of the selected record is automatically displayed in the linked window objects. See paragraph 9.4 Database related objects for a detailed description of the database objects.
Below you will find a short description of the commonly used database related terminology.
Word Explanation Table A record collection. Record A line in a table consisting out of several record fields. Record field A specific field in a record. Scrolling Walking through the records in a table. A button, which selects the next record, and a button, which selects the previous record, can do this. Key This is a specific record field from a record, which is used to identify the record with. Imagine that you want to search an article table for an article with article number ‘025’. For this purpose the key is set to article number because after that this field is used to search a record in the table. SQL This is a standard language (Structured Query Language) used in order to perform actions on a database. For example you are able to select, delete or add specific records by using SQL.
9 The DL-file.
The function of a DL-file (Definition List) is to define a window with its linked objects and linked databases. This chapter explains how to build a DL file and which objects are available.
9.1 The layout of a DL-file.
DL files are normal text files in which the different objects are defined. Each object has several properties. Some of these properties are common (like position, name and colour) other properties are specific for a type of object. The object definitions in the DL-file must be according to the following syntax:
[] = . . .
indicates the type of object. The object type is followed by one or more properties belonging to the object. If an object property is not included in the DL-file the default value for that property is automatically used.
In the next paragraphs all available objects are explained. For each object the following items will be discussed:
The object type for each object the object type must be placed at the beginning of the object definition. The type must be between two brackets (example: [CLABEL])
Description: A short description of the object.
Properties: A description of all the properties belonging to the object.
Possible events: The events that may be generated by the object. The names of the events are used to generate an event as described in chapter 2.
Primary property: The value of this property is returned if a reference to the object is used when calling a function. The functions “F_GetObject” and “F_SetObject” also use this property. See the description of these two function for more detailed information.
Example: An example of the definition of the object. The examples can be used in a DL file in order to test the object definition.
Picture: The result on the screen if the text of the example is used in a DL file.
Remark: The first object that must be defined in a DL-file is the FORM object.
9.2 Window related objects.
In this chapter explains all objects that can be used in your program.
Below you will find a list of all available objects.
Object type Description FORM This object displays a window BUTTON This object displays a button LABEL, CLABEL This object displays a textbox (no input) TEXT, CTEXT This object displays a text input box with only one line CURRENCY, CCURRENCY This object displays a currency field MEMO, CMEMO This object displays a text input box with several lines PULLDOWN, CPULLDOWN This object displays an option list IMAGE This object displays a picture (bitmap) LINE This object displays a line RECTANGLE This object displays a rectangle CIRCLE This object displays a circle BOX This object displays a filled rectangle
9.2.1 FORM
Description: A form object displays a window on the screen. This object must be the first object defined in each DL-file. The name of the FORM object is the same as the name of the corresponding DL-file without the extension.
Properties: Caption The title of the window Width The width of the window Height The height of the window Top The Y component of the top left corner of the window Left The X component of the top left corner of the window
Possible events: Unload This event will occur if a previously loaded window is unloaded using the function “F_UnloadWindow”
Primary property: None
Example: Picture:
[FORM] Caption = Window 1 Width = 2000 Height = 1000 Top = 100 Left = 100
9.2.2 BUTTON
Description: This object displays a button on a form. A button is a rectangular area on which the user may click in order to start an action (function).
Properties: Name The name of the button Caption The text on the button Width The width of the button Height The height of the button Top The Y component of the top left corner of the button Left The X component of the top left corner of the button
Possible events: Click This event is started when the user clicks on the button
Primary property: Caption This property is used by the functions "F_GetObject" and "F_SetObject"
Example: Picture:
[BUTTON] Name = butSave Caption = Save Width = 1200 Height = 300 Top = 100 Left = 100
9.2.3 LABEL, CLABEL
Description: This object displays a text on a form object. At runtime the user is not able to change the text of the label. The difference between a LABEL object and a CLABEL object is that a CLABEL object has a title above the textbox.
Properties: Name The name of the label Width The width of the label Height The height of the label Top The Y component of the top left corner of the label Left The X component of the top left corner of the label Text The text inside the label object Alignment This property sets the alignment of the text in the label. The following options are available: - Left Left alignment of the text in the label - Centre Centre alignment of the text in the label - Right Right alignment of the text in the label Fcolor This property sets the forecolour of the label title (only for CLABEL) Bcolor This property sets the backcolour of the label title (only for CLABEL) Caption The text of the title of a CLABEL object
Possible events: None
Primary property: Text This property is used by the functions "F_GetObject" and "F_SetObject"
Example 1: Picture: Example 2: Picture:
[CLABEL] [LABEL] Name = lblClientNo Name = lblClientNo Caption = ClientNo. Text = 380206 Text = 380206 Width = 700 Width = 700 Height = 200 Height = 200 Left = 125 Left = 125 Top = 400 Top = 400 BColor = Cyan Alignment = Left
9.2.4 TEXT, CTEXT
Description: This object displays a textbox on a form, in which the user is able to enter data. The difference between a TEXT object and a CTEXT object is that a CTEXT object has a title above the input box.
Properties: Name The name of the text Width The width of the text Height The height of the text Top The Y component of the top left corner of the text Left The X component of the top left corner of the text Text The text inside the text Mask This property can be used to enter a mask for the data that is entered in the textbox. The mask can be set in two different ways. The first option is to use one of the predefined masks. The second option is to enter a mask for each character position.
Predefined masks: mskFixed The entered text must represent a number with two decimal places. Alphabetical characters are not allowed. It is possible to enter a range for this mask using the following format: Mask = mskFixed; ; Example: Mask = mskFixed;1;25
mskDate The entered text must be in the following format: DD-MM-YYYY.
mskNumeric The entered text must represent a number without decimal places. It is possible to enter a range for this mask using the following format: Mask = mskNumeric; ; Example: Mask = mskNumeric;1;25
Mask for each separate position: 0 Only the numbers (0..9) are allowed X, x All characters are allowed. By using a “X” all entered characters are transferred to capitals. Using “x” will transfer all characters to non-capitals A, a Only alphabetic characters are allowed. By using “A” all entered characters are transferred to capitals. Using “a” will transfer all characters to non-capitals ? All characters are allowed ( … ) Only the characters between the parentheses are allowed. t[ … ] Repeat the mask character 't' the number of times between the brackets.
Example:
Mask = 00X[5]??(ABC)
On the first two positions only numbers are allowed. The next five positions all characters are allowed. All alphabetic characters are transferred into capitals. The next two positions may be any character. The last position must be an “A”, a “B” or a “C”.
Locked This property indicates whether or not the text of the text object can be changed. TRUE = no changes allowed, FALSE = the text may be changed Secure This property indicates whether the text of the text object is readable (FALSE) or secured (TRUE). Secure means that the text is not displayed but for each entered character a “*” is shown. Refresh This property indicates whether the text object must be refreshed when calling the function "F_RefreshWindow". TRUE = update, FALSE = no update. Default The default value of the text inside text object, which is set when calling "F_RefreshWindow". Fcolor This property sets the forecolour of the text title (only for CTEXT) Bcolor This property sets the backcolour of the text title (only for CTEXT) Caption The text of the title of a CTEXT object
Possible events: Return This event is started when the user clicks on the 'Return'-key while in the text Escape This event is started when the user clicks on the 'Esc'-key while in the text LostFocus This event is started when the user clicks on the text
Primary property: Text This property is used by the functions "F_GetObject" and "F_SetObject"
Example 1: Picture 1: Example 2: Picture 2:
[CTEXT] [TEXT] Name = txtDiscount Name = txtDiscount Caption = Discount Width = 725 Width = 725 Height = 300 Height = 300 Left = 2700 Left = 2700 Top = 950 Top = 950 Default = 10,00 Alignment = Centre Mask = mskFixed;0;100 BColor = Green Default = 10,00 Mask = mskFixed;0;100
9.2.5 CURRENCY, CCURRENCY
Description: This object is used to show an amount in different currencies. By changing the appropriate properties the shown amount is transferred in another currency. The user is not allowed to change the amount in a currency object directly. The only possible ways to change the amount in the currency object is by using the function “F_SetObject” or by using a database link. By using the function “F_SetObject" an amount is written in the currency object. The amount shown on the screen is calculated using the amount and the exchange rate using the following formula:
= ( / ) * (Rounded off using 2 decimals)
If the factor or the exchange rate is changed, the amount is recalculated automatically and displayed on the screen. The original amount set by the function “F_SetObject” can be retrieved by using the function “F_GetObject".
Remark: The user can’t see which kind of currency is used for the displayed amount in the currency object. Printing a text besides the currency object, which indicates the used currency, solves this problem.
Properties: Name The name of the currency object Width The width of the currency object Height The height of the currency object Top The Y component of the top left corner of the currency object Left The X component of the top left corner of the currency object Rate The exchange rate Factor The currency factor Refresh This property indicates if the currency object must be refreshed when calling the function "F_RefreshWindow". TRUE = update, FALSE = no update. Alignment This property sets the alignment of the value in the currency object. The following options are available: - Left Left alignment of the value - Centre Centres alignment of the value - Right Right alignment of the value Fcolor This property sets the forecolour of the currency object title (only for CCURRENCY) Bcolor This property sets the backcolour of the currency object title (only for CCURRENCY) Caption The text of the title of a CCURRENCY object
Possible events: Primary property: None Special, see description
Description: This object displays an input box, which consists out of several lines. The user can scroll through the lines in the object by using the arrow keys.
Properties: Name The name of the memo Width The width of the memo Height The height of the memo Top The Y component of the top left corner of the memo Left The X component of the top left corner of the memo Text The text inside the memo object Flat This property indicates whether the memo object is shown in 3D mode (FALSE) or Flat mode (TRUE). Locked This property indicates whether the text of the memo object can be changed. TRUE = no changes allowed, FALSE = the text may be changed Refresh This property indicates if the memo object must be refreshed when calling the function "F_RefreshWindow". TRUE = update, FALSE = no update. Default The default value of the text inside memo object, which is set when calling "F_RefreshWindow". Fcolor This property sets the forecolour of the memo title (only for CMEMO) Bcolor This property sets the backcolour of the memo title (only for CMEMO) Caption The text of the title of a CMEMO object
Possible events: Return This event is started when the user clicks on the 'Return'-key while in the memo Escape This event is started when the user clicks on the 'Esc'-key while in the memo LostFocus This event is started when the user clicks on the memo
Primary property: Text This property is used by the functions "F_GetObject" and "F_SetObject"
Example 1: Picture 1:
[CMEMO] Name = txtRemark Caption = Here you can enter additional information Width = 3275 Height = 1000 Left = 125 Top = 1025 BColor = Magenta Alignment = Centre
Example 2: Picture 2:
[MEMO] Name = txtRemark Width = 3275 Height = 1000 Left = 125 Top = 1025
9.2.7 PULLDOWN, CPULLDOWN
Description: This object displays a list box in which the user may select an option from the list.
Properties: Name This is the name of the pulldown. This name is used when generating an event Width The width of the pulldown on the screen Top The Y component of the top left corner of the pulldown Left The X component of the top left corner of the pulldown List This property is used to fill the pulldown with options. A comma separates the options
Example: List = option 1, option 2, option 3, etc.
Fcolor This property sets the forecolour of the pulldown title (only for CPULLDOWN) Bcolor This property sets the backcolour of the pulldown title (only for CPULLDOWN) Caption The text of the title (only for CPULLDOWN)
Possible events: Return This event is started when the user clicks on the 'Return'-key while in the pulldown Escape This event is started when the user clicks on the 'Esc'-key while in the pulldown Click This event is started when the user clicks on the pulldown
Primary property: Special: the function "F_GetObject" returns the selected option and the function "F_SetObject" has no effect on the pulldown.
Example 1: Picture 1: Picture 2:
[CPULLDOWN] Name = lstChoice Caption = Please make a choice Width = 1500 Height = 300 Left = 100 Top = 100 List = Option 1,Option 2,Option 3
Example 2: Picture 3: Picture 4:
[PULLDOWN] Name = lstChoice Width = 1500 Height = 300 Left = 100 Top = 100 List = Option 1,Option 2,Option 3
9.2.8 IMAGE
Description: With this object you can show a bitmap picture on a form object. The original size of the picture is transferred to the size determined by the properties “width” and “height”.
Properties: Name The name of the image used when starting an event Width The width on the screen of the image Height The height on the screen of the image Top The Y component of the top left corner of the image Left The X component of the top left corner of the image Filename The name of the bitmap file (.BMP). The whole filename must be entered (including the extension). If the file path is not included in the filename then the file is searched in the FlexIT directory.
Possible events: None
Primary property: None
Example: Picture:
[IMAGE] Name = afbSave Width = 500 Height = 500 Left = 100 Top = 100 Filename = diskette.bmp
9.2.9 LINE
Description: This object displays line on the form object.
Properties: Arguments The argument property contains all the parameters for this object in the following order: X1, Y1, X2, Y2, Colour. X1, Y1 represent the co-ordinates of the start position of the line. X2, Y2 represent the co-ordinates of the end position of the line. For the supported colours see the list of reserved words in paragraph 9.3.
Description: This object displays an open rectangular box on the screen.
Properties: Arguments The argument property contains all the parameters for this object in the following order: X1, Y1, X2, Y2, Colour. X1, Y1 represent the co-ordinates of the top left corner of the rectangle. X2, Y2 represent the co-ordinates of the bottom right corner of the rectangle. For the supported colours see the list of reserved words in paragraph 9.3.
Description: This object displays a circle on a form object.
Properties: Arguments The argument property contains all the parameters for this object in the following order: X1, Y1, Radius, Colour. X1, Y1 represent the co-ordinates of the centre of the circle. For the supported colours see the list of reserved words in paragraph 9.3.
Possible events: None
Primary property: None
Example: Picture:
[CIRCLE] Arguments = 100 , 100 , 50 , Black
9.2.12 BOX
Description: This object displays a filled rectangular box on the screen.
Properties: Arguments The argument property contains all the parameters for this object in the following order: X1, Y1, X2, Y2, Colour. X1, Y1 represent the co-ordinates of the top left corner of the rectangle. X2, Y2 represent the co-ordinates of the bottom right corner of the rectangle. For the supported colours see the list of reserved words in paragraph 9.3.
9.3 Reserved words When filling in the properties of the different objects a number of reserved words can be used. These reserved words can be divided into the categories below:
Colours Black Red Green Yellow Blue Magenta Cyan White
Date & Time $Date (system date) $Time (system time)
9.4 Database related objects.
9.4.1 DBSEARCHBOX
Description: This object is used in order to scroll through a database table. Scrolling is done by clicking on the buttons “” or by typing a part of the searched data.
Properties: Name The name of the dbsearchbox Caption The title of the dbsearchbox. This text is shown on the screen. Width The width of the dbsearchbox Height The height of the dbsearchbox Top The Y component of the top left corner of the dbsearchbox Left The X component of the top left corner of the dbsearchbox
Possible events: RecordChange This event is triggered when the user scrolls through the database.
Primary property: The function “F_GetObject” will return the value visible in the dbsearchbox. The function “F_SetObject” will search the database for the selected value and displays it in the dbsearchbox. If the selected value is not found, the value closest to this value is displayed.
Example: Picture:
[DBSEARCHBOX] Name = sbxArticles Caption = ArticleNo. Width = 900 Height = 300 Left = 125 Top = 950 BColor = Green
9.4.2 DB
Description: With this object the links between the database and the window objects are defined.
Properties: Name The name of the database
Table The database table, which the database relates to.
SQL A SQL command in order tot sort the database. If this property is not used all records from the table are selected automatically.
KeyField With this property the database field used in order to identify a record and scroll through the database table is selected. The content of this field is displayed in the window object that is selected by the "KeyObject" property. By using a second parameter it is possible to define if the database table should be sorted ascending (ASC) or descending (DESC).
KeyObject This is the name of the window object used to scroll through the database. The key object must be a list box (PULLDOWN) or a search box (DBSEARCHBOX).
The name of the object you enter here must be defined prior to the definition of the database object. If a PULLDOWN object is selected as “KeyObject” it is allowed to enter the action that has to be performed whenever the user makes a choice from the list. The PULLDOWN object supports the following actions: FILL No action but fill the list MOVE After a selection in the list is made the record pointer of the database is moved. UPDATE After a selection in the list is made all linked fields are updated. If a DBSEARCHBOX is selected as "KeyObject" the UPDATE action is performed automatically.
Link With this property it is possible to connect window objects to record fields in the database. These linked window objects are automatically updated when scrolling through the database (see "KeyObject"). It is allowed to enter more than one link. With the first parameter the name of the selected window object is set. The second parameter sets the name of the database field. The last parameter sets the connection type. The connection type refers to the action that is performed when a record is updated (see the "Update" property). The following links are supported: R read only, only read actions are performed on the database field W write only, only write actions are performed on the database field RW read and, read actions as well as write actions are performed on the database field If the connection type is not entered the RW link is automatically selected.
Update With this property a button is assigned for updating a record. Whenever this button is clicked the values of the window objects are written into the corresponding database fields. Only the fields with the connection type set to W or RW are updated.
Delete The name of the button used in order to delete a record from the database object.
New The name of the button used in order to add a new record to the database object. The information used when filling the new record with data is assigned by the NEWRECORD object.
Refresh With this property it is possible to select if the window object assigned by the “KeyObject” has to be updated after an action (delete, add or update) on the database is performed.
Example:
[DB] Name = dbOrderLines Table = OrderLinesTable SQL = SELECT * FROM OrderLinesTable WHERE OrderNo = R_1 ORDER BY ArtNo ASC KeyField = ArtNo,ASC KeyObject = pulOrderLines,UPDATE Link = txtQuantity,ArtQuantity,RW Link = txtDiscount,ArtDiscount,R Link = txtPrice,ArtPrice,R Link = $Date,Date,W Link = $Time,Time,W Refresh = True Update = butORSave Delete = butORDelete New = butORAdd
The above object definition creates a database object, which uses the “OrderLinesTable”. From this table all records belonging to the order with the order number from register R_1, are selected.
The article numbers are sorted ascending (ASC) and copied to the list box “pulOrderLines”. When the user selects an article number from the list box, all linked fields are automatically updated with the corresponding data (UPDATE).
For each order line the quantity (ArtQuantity), the discount (ArtDiscount) and the price (ArtPrice) are shown in the corresponding window objects “txtQuantity”, “txtDiscount” and “txtPrice”.
The quantity is the only field that may be changed by the user (RW). The article prices and article discounts are read only (R). The date and time are only updated in the database record (W).
Whenever the user clicks on the button “butORSave”, the data in the record is updated with the data from the window objects. A record is deleted when the user clicks on the button “butORDelete”. If the button “butORAdd” is clicked, a new record is added according to the data format as defined in the NEWRECORD object.
9.4.3 NEWRECORD
Description: With this object the layout of a new record of a database object is described.
Properties: DB The name of an previously defined database object in which the new record should be added Link The link between the database field and the object (window object, register or reserved word).
Example:
[NEWRECORD] DB = dbOrderLines Link = R_1,OrderNo Link = sbxArticles,ArtNo Link = txtQuantity,ArtQuantity Link = txtDiscount,ArtDiscount Link = txtPrice,ArtPrice Link = $Date,Date Link = $Time,Time
The order number is read from register “R_1” and saved in the database field “OrderNo”. The article number is read from the search object “sbxArticles” and saved in the database field “ArtNo”. The quantity, the discount and the price are read from the corresponding window objects “txtQuantity”, “txtDiscount” and “txtPrice” and saved in the database fields “ArtQuantity”, ArtDiscount” and “ArtPrice”.
10 Function library
This chapter contains a list of all functions available in the FlexIT library.
Window related functions Function name Short description F_LOADWINDOW Create a window using a DL-file F_UNLOADWINDOW Delete a window en release the used memory F_DISABLEWINDOW Disable a window F_ENABLEWINDOW Enable a window F_HIDEWINDOW Hides a created window F_SHOWWINDOW Shows a created window F_REFRESHWINDOW Refresh a window on the screen
Object functions Function name Short description F_HIDEOBJECT Hides an object F_SHOWOBJECT Shows an object F_DISABLEOBJECT Disables an object F_ENABLEOBJECT Enables an object F_GETOBJECT Returns the primary value of an object F_SETOBJECT Sets the primary value of an object F_SETPROPERTY Sets a property of an object
Listbox functions Function name Short description F_REMOVEITEM Deletes an option from the list F_ADDITEM adds an option to the list F_SETITEM Activates an option from the list
String functions Function name Short description F_ISSTREMPTY Checks of a passed variable is empty F_COPYSTR Copies the contents of a string F_TRIMSTR Trims the leading and trailing spaces from a string F_ADDSTR Concatenates strings together
Mathematical functions Function name Short description F_ADD Adds two values together F_SUB Substracts two value from each other F_MUL Multiply two values F_DIV Divides two values F_RND
Event related functions Function name Short description F_GENERATEEVENT Generates an event F_ENDEVENT Ends an event row
Date/time functions Function name Short description F_TIME Returns the system time F_DATE Returns the system date F_CALCDATE Calculates a new date
Sound functions Function name Short description F_SOUND Plays a WAV file
Database functions Function name Short description F_GETRECORDCOUNT Returns the number of records in a table F_DOSQL Runs an SQL command F_GETMAXFIELDVALUE Returns the maximal value of a field from a range of records
Register functions Function name Short description F_SETREG Sets the value of a register F_GETREG Returns the value of a register
Financial functions Function name Short description F_BEREKENTOTAALPRIJS Calculates a price total from a quantity, a discount and an article price
Special functions Function name Short description F_EVAL Evaluates an expression on True of False
Other functions Function name Short description F_GETYESNO Shows a window with a Yes or No question F_MSGBOX Shows a message window F_END Ends the program
10.1 The special function IF In some situations it is necessary to be able to evaluate an expression, for example in order to check whether the user entered valid information. In FlexIT we use the function “IF” for this purpose. The structure of this function looks like a normal IF..THEN..ELSE structure. De function call looks like:
IF( , , )
• Expression The value of expression may be 0 or 1. It is allowed to call the function “F_EVAL” in order to evaluate an expression but also any other function, which returns a 1 or a 0.
• Function 1 This function is called when the expression equals 0
• Function 2 This function is called when the expression equals 1
After the evaluation of the expression only one function can be called. In some situations several functions are required. Starting a sequence of several functions after an evaluation is possible by calling “F_GenerateEvent” which is described later in this chapter.
10.2 A detailed description of all functions
------ Window related functions ------ 10.2.1 F_LOADWINDOW
Description: This function will load a window as defined in the corresponding DL-file. The loaded window is not shown yet. This will happen when the function “F_ SHOWWINDOW” is called. If the corresponding DL-file is not found an error message is generated.
Syntax: F_LoadWindow( )
Parameters: Window name The name of the corresponding DL-file
Return value: None
Example: TASK:Event;F_LoadWindow("TestWindow")
10.2.2 F_UNLOADWINDOW
Description: This function unloads a previously loaded window and releases the reserved memory. The loaded window is identified by the name of the corresponding DL-file. If the selected window is still loaded an error message is generated.
Syntax: F_UnloadWindow( )
Parameters: Window name The name of the window that should be unloaded
Return value: None
Special: After this function is called a special event is started with the following format:
. . Unload
Example: TASK:MAIN.butShow.Click;F_ShowWindow("TestWindow”) . . . TASK:MAIN.butShow.Click.TestWindow.Unload;. . . This event is started after calling F_UnloadWindow("TestWindow").
Example: TASK:Event;F_UnloadWindow("TestWindow")
10.2.3 F_DISABLEWINDOW
Description: This function disables an object on the screen. De user can no longer perform actions on the objects located on this window. This means that although the window is still visible all actions of the user on this window are discarded. This function may be helpful if you want to avoid that the user starts other actions while a time consuming action is still running. If the selected window is not found an error message is generated.
Syntax: F_DisableWindow( )
Parameters: Window name The name of the window that should be disabled
Description: This function will enable a previously disabled window. If the selected window is not found an error message is generated.
Syntax: F_EnableWindow( )
Parameters: Window name The name of the window that should be enabled
Return value: None
Example: TASK:Event;F_EnableWindow("TestWindow ")
10.2.5 F_HIDEWINDOW
Description: This function will hide the selected window for the user. If the selected window is not found an error message is generated.
Syntax: F_HideWindow( )
Parameters: Window name The name of the window that should be hidden for the user
Return value: None
Example: TASK:Event;F_HideWindow("TestWindow")
10.2.6 F_SHOWWINDOW
Description: This function shows a previously loaded window on the screen. If the selected window can’t be found automatically the function “F_LoadWindow” is called with the selected window name passed to it. This means that the window is loaded automatically.
Syntax: F_ShowWindow( )
Parameters: Window name The name of the window to be shown
Return value: None
Example: TASK:Event;F_ShowWindow("TestWindow ")
10.2.7 F_REFRESHWINDOW
Description: This function will refresh a window. This means that all the objects on the window with the “Refresh” property set tot TRUE are filled with the value from the “Default” property.
Syntax: F_RefreshWindow( )
Parameters: Window name : The name of the window to refresh.
Return value: None
Example: TASK:Event;F_RefreshWindow("TestWindow")
------ Object related functions ------
10.2.8 F_HIDEOBJECT
Description: This function will make an object invisible. Although the object is no longer visible it still exists. It is still possible to perform operations on an invisible object. If the selected object is not found an error message is generated.
Syntax: F_HideObject( )
Parameters: Objectname The name of the object that should be hidden
Description: This function disables an object on the screen. De user can no longer perform actions on the object. This means that although the object is still visible all actions of the user on this object are discarded. A disabled object changes into lighter colours. If the selected object is not found an error message is generated.
Syntax: F_DisableObject( )
Parameters: Object name The name of the object that should be disabled
Description: This function will enable a previously disabled object. The colours of the object change back to the original colours and the user can perform actions on the object again. If the selected object is not found an error message is generated.
Syntax: F_EnableObject( )
Parameters: Object name The name of the object that should be enabled
Description: This function will read the value of the primary property of an object. If an object has a primary property this is indicated in the object description (see the description of a DL-file). If the selected object is not found an error message is generated.
Syntax: F_GetObject( )
Parameters: Object name The name of the object from which the primary property should be read
Description: With this function the value of one of the properties from an object can be set. The known properties and the corresponding values of each object are described in the object description. If the selected object could not be found or if an invalid property is selected, an error message occurs.
Syntax: F_SetProperty( , , )
Parameters: Object name The name of the object from which the property should be set Property The name of the property of the object that should be set Value The value that should be assigned to the property
Description: This function deletes an option from a list box. If the selected option is not found no error message is generated. If the list box could not be found an error message is generated.
Syntax: F_RemoveItem( , )
Parameters: Object name The name of the list box Option The name of the option, which must be deleted from the list
Description: This function activates an option from a list box. If an option could not be found no error message is generated but the selection in the list box will not change. If the list box could not be found an error message is generated.
Syntax: F_SetItem( , )
Parameters: Object name The name of the list box Option The choice from the list box that should be activated.
In this example the function “F_Function” is executed if the input field “txtText” from the window “TestWindow” is empty.
10.2.19 F_COPYSTR
Description: This function copies a part from a string. It is possible to mark the part to be copied in two different ways: - Mark the start position and end position of the copy action by entering a search string for both positions. You may select to include the entered search strings into the result. - Mark the start position and the end position by directly entering the character position in the string. If the entered end position lies before the entered start position an error message occurs.
Syntax: F_CopyStr( , , , , , , )
Parameters: StrC The source string from which a part is copied StrL You may enter a search string here. This string will be the start position StrR You may enter a search string here. This string will be the end position. InsL If StrL is empty this parameter contains the start position of the copy action in the source string. If StrL is not empty this parameter will represent the occurrence of StrL from which the copy action should start. InsR If StrR is empty this parameter contains the end position of the copy action in the source string. If StrR is not empty this parameter will represent the occurrence of StrR where the copy action should end. InclL This parameter indicates whether StrL is included (InclL = 1) or excluded (InclL = 0) in the copied string. InclR This parameter indicates whether StrR is included (InclR = 1) or excluded (InclR = 0) in the copied string.
Return value: The part that is copied from the source string
Example: TASK:Event;F_SetReg( R_1 , F_CopyStr( "This is a test text" , "is" , "te" , 1 , 2 , 1 , 0 ))
Copies "is a test " in the register R_1
TASK:Event;F_SetReg( R_1 , F_CopyStr( " This is a test text " , "" , "" , 1 , 6 , 0 , 0 ))
Copies "This i" in the register R_1
TASK:Event;F_SetReg( R_1 , F_CopyStr( " This is a test text " , "is" , "" , 1 , 10 , 1 , 0 ))
Copies "is a " in the register R_1
10.2.20 F_TRIMSTR
Description: This function removes the leading and trailing spaces from a string. The result will be a string with no leading and trailing spaces.
Syntax: F_TrimStr( )
Parameters: String The string from which the leading and trailing spaces should be removed.
Return value: The string from which the leading and trailing spaces are removed
If txtAddress contains the text " Hello " than the above example will return "Hello" in the register R_1.
10.2.21 F_ADDSTR
Description: This function will concatenate two strings together. The result of the function is one string containing the characters from both strings.
Syntax: F_AddStr( , )
Parameters: String1 The first string String2 The string that should be concatenated to the first string
Return value: The result of the concatenation String1 + String2.