EPL Programming Elements

This chapter describes the basic elements of EPL.

EPL Naming Rule

In the source code of an EPL application, whatever variable/function/data type etc, their name must start from english character and without non-english or non-number character in it.

EPL supports unlimited length name, and the name will never conflict to EPL language keywords due to EPL is an command-base language, such as ”If”, “While” those are all commands (functions).

Data Types

EPL data types are classified by System-Basic data type, Library-Defined data type and User-Defined data type.

 

System-Basic Data Type

Data Type Description
Byte Contains an integer value between 0 to 255. 1 byte size (8 bits).
Short Contains an integer value between -32768 to 32767. 2 bytes size (16 bits).
Integer Contains an integer value between -2147483648 to 2147483647. 4 bytes size (32 bits).
Int64 Contains an integer value between -9223372036854775808 to 9223372036854775807. 8 bytes size (64bits).
Float Contains a floating point value between 3.4E-38 to 3.4E38. 4 bytes size (32 bits).
Double Contains a floating point value between 1.7E-308 to 1.7E308. 8 bytes size (64 bits).
Boolean Contains a value to indicate True or False. 2 bytes size (16 bits)
DateTime Records date and time. 8 bytes size (64 bits).
String A character string terminated with 0. Stores text data.
Bin A data section in binary format. The Bin and Byte Array convert between from each other. The difference between Bin and Byte Array is Bin can change length automatically or manually, but Byte Array can only change length manually.
FunctionAddress A pointer to a function to indicate function's address. 4 bytes size (32 bits). This data type is only valid in Dll command parameter.

 

Byte/Short/Integer/Int64/Float/Double can be named as "Number", converting between each number type is possible.

Number: converting may possibly lose data precision.

All data type only be valid in internal EPL system, matches all supported data types

 

Library-Defined Data Type

Library-Defined data type is provided by EPL internal library, it can be used directly in EPL, just like system basic data type

 

User-Defined Data Type

You can freely to define your own data type (User-Defined Data Type), the data type can contain System-Basic Data Type and Library-Defined Data Type. To add a new user-defined data type, just click “Insert” -> “Data Type” menu.

Constants

EPL supports constants to store & express constant value that won’t be changed when the application is running. The data type of constant value can be Number, String, Boolean and DataTime. To define a new constant, just click “Insert” ->”Constant menu”. To use a constant value, plus a “#” mark before the constant name in source code. Such as: “#Pi” to instead of number “3.1415926535”.

Variable

EPL Variable has three different Operating-Domains, they are Global, Module and Local. The Global Variable can be used in any code-able place, the Module Variable can be used in any code-able place of a module, and the Local Variable can be used in any code-able place of its contained function.

The variable also can be static type as usual. Unstatic Variable in EPL can be initialized automatically. To evaluate a variable, just use a “=” operator or “Set” function.

EPL also supports Variable Array, to use array just use mark “[][]” to specify the element index of an array.

Operator

Using operator in EPL, there are two ways, using operator or using command (function) name to instead, because EPL is a command-based programming language. The following lists all the operator of EPL. Notice that, smaller priority number for higher priority

Operator Priority Command Name Description
- 1 Neg Returns the negative value of a numeric value
* 2 Mul Returns the product of two numeric values
/ 2 Div Returns the quotient of two numeric values
\ 3 DivE Returns the integer part of the quotient of two numeric values
% 4 Mod Returns the remainder of two numeric values
+ 5 Add 1, Returns the sum of two numbers; 2, Concatenates two String and return the result; 3,Concatenates two Bin and returns the result
- 5 Sub Returns the difference between two numeric values
<> 6 Unequal Returns True if the "Value1" is not equal to "Value2", otherwise returns False
= 6 Equal Returns True if the "Value1" is equal to "Value2", otherwise returns False
< 6 Less Returns True if "Value1" is less than "Value2", otherwise returns False
> 6 Greater Returns True if "Value1" is greater than "Value2", otherwise returns False
<= 6 LessEqual Returns True if "Value1" is less than or equal to "Value2", otherwise returns False
>= 6 GreaterEqual Returns True if "Value1" is greater than or equal to "Value2", otherwise returns False
&& 7 And Returns True if the two parameters are both True, otherwise returns False.
|| 8 Or Returns True if any one of the two parameters is True, otherwise returns False
= 9 Set Value assignment

Function

For user-defined functions, it is very often to use by developer, the EPL function represents very flexible & powerful way to write your own-defined functions.

The EPL Function Parameter can be passed by reference, also can be optional and with a default value setting. To pass variable array is also be allowed.

To exit your function and return a value, just call "Return(YourReturnValue)” function.

Flow Control

To control the flow of EPL source code, it is by commands that list below.

Command Name Description Picture
If Determines the executing flow according to the condition. The routine will execute ordinally if the parameter is True, otherwise the routine will jump to the code pointed by the left arrow
IfTrue Determines the executing flow according to Boolean parameter. The routine will execute ordinally if the parameter is True, otherwise the routine will jump to the code that pointed by the left arrow. Notice: This function has no "False" part, that's different like "If" function
Case Determines the executing flow according to the Boolean parameter. The routine will execute ordinally if the parameter is True, otherwise the routine will jump to the next branch of "Case" to determine  
Do Enters the loop None
For Repeats the loop body that between "For" and corresponding "Next". Initializes "LoopVar" by "StartingValue" when executes this command first time. Determines whether the "LoopVar" is greater than "EndingValue" when executes to this command every time, exits the loop body to executes the statement after the corresponding "Next" if True, otherwise continues the loop
Continue Jumps to the ending of the current loop body immediately None
Break Exits the current loop body immediately to execute the statement after current loop None
Return Stops the execution of a function and returns control to the calling function. A return statement can also returns a value to the calling function None
End Stops current running EPL program None

Form

Under windows, EPL provides very rich & powerful form programming elements than ever. Form in EPL is like an object, contains Method, Property and Event. All the necessary & basic function is supported. Without that, EPL provides a very rich form shape effects.

The following describes Form in details.

EPL 4.0 Form Properties List

Property Name Description
Left Specifies the location of the left edge of the form
Top Specifies the location of the top edge of the form
Width Specifies the width of form, in pixels units
Height Specifies the height of form, in pixels units
Tag Specifies extra string type value for form or program
Visible Specifies the visibility of a form
Disable Specifies whether the form is disabled
MousePointer Specifies the mouse pointer for the form
Caption Specifies caption for the form
Border Specifies the type of the form border
BackColor Specifies background color for form
Picture Specifies the background picture for form displaying
PictureMode Specifies the displaying style if there's background picture
BackMusic Specifies the music for playing when the form is loaded
RepeatTime Specifies how many times the back music will be played
ControlButtons Specifies whether display all the control button and menu
MaxButton Specifies whether display maximize button and restore button
MinButton Specifies whether display minimize button
Position Sets the position and state of the form
Moveable Specifies whether the form can move
EnterFocusDown If this property is True, the focus will be moved to next control when Enter key is press on the form. If this property is False, the Enter key refers to the default button
EscToClose Specifies whether allow user to use Esc key to close form
F1ToHelp Specifies whether user can press F1 to open the help-information about this form
HelpFileName The help file name. If this is not specified, the default help file name(exe file name, exclude suffix, + .hlp) is used
HelpContext Specifies the help tag
InTaskBar Specifies whether the window showed in the windows task
FreeMove Sets whether the form can be drag when left mouse button is down at any position of the form. If this property is True, all the controls in the form that cannot have focus does not received "LButtonDown" and "LButtonUp" event
FormShape Specifies form shape for looking
AlwasyOnTop Specifies whether the form is always on the top of any other forms
TitleBarActive Specifies this property to be True if you wish the title bar always be active

EPL 4.0 Form Methods List

Method Name Description
GetHWnd Returns a handle to a form or a control, the handle is just Win32 HWND
Destroy Destroys this form and all controls on this from. Loads the form again to use if the form has been destroyed
SetFocus Moves the focus to this form or control. For a form, the focus will move to the first control that can accept focus
HasFocus Indicates whether the control has the focus
GetClientWidth Returns the width of client area, in pixels units. For a form, the client area is the entire area of the window excludes title bar, menu bar, frames. For a control, its client area is equal to its entire area
GetClientHeight Returns the height of client area, in pixels units. For a form, the client area is the entire area of the window excludes title bar, menu bar, frames. For a control, its client area is equal to its entire area
DisableRedraw Disables the redraw operation of a Form or control to avoid flicker. "EnableRedraw" can be called to resume
Redraw Notifies the Windows system that the entire area of this Form or Control need to be redrawed
RedrawRect Notifies the Windows system that the specified rectangle of this Form or Control needs to be redrawed
CancelRedraw Notifies the Windows system that this Form or Control does not need to be redrawn, all its display content will be reserved
Refresh Redraws if displaying content of this from or control need to redraw, otherwise returns immediately
Move Changes the position or size of a Form or Control
Zorder Changes the layer of a Form or Control
PopupMenu Displays the menu at the specified position or the current mouse position. Automatically use its container form if called object is window control
SendMessage Sends the specified message to a window or control. It calls the window procedure for the specified window and does not returns until the window procedure has processed the message
PostMessage Places (posts) a message in the message queue associated with the thread that created the specified window and returns without waiting for the thread to process the message
GetTagControl Returns the control that contains the specified numerical string in the current Window Form. An runtime occurs if doesn't exist
SetShapePicture Sets the shape of the form with the picture, Note: the picture format can't be icon or cursor. The contour of the picture should be as solid as possible, that can make the refreshing speed of the Window Form faster. Returns True if succeeds, otherwise returns False
Activate Activate a form
SetTrayIcon Sets an icon that indicated this program to system tray
PopupTrayMenu Pops up menu in the current mouse position, this function is for popuping system tray icon menu
SetParent Sets specified form or form control as parent form of this object

EPL 4.0 Form Events List

“System Basic-Events” & “Control Self-Events”

“System Basic-Events” is provided by the system, all form controls has these events. In list below will mark as type of “Basic”.

“Control Self-Events” is provided by specified control itself. In list below will mark as type of “Self”.

Events Name Events Name Type
LButtonDown Occurs this event when the user presses the left mouse button while the cursor is on the form Basic
LButtonUp Occurs this event when the user releases the left mouse button while the cursor is on the form Basic
DblClick Occurs when the user presses and releases a mouse button and then presses and releases it again on the form Basic
RButtonDown Occur this event when the user presses the right mouse button while the cursor is on the form Basic
RButtonUp Occurs this event when the user releases the right mouse button while the cursor is on the form Basic
MouseMove Occurs when the user moves the mouse on the form Basic
GetFocus Occurs this event when object got inputting focus Basic
LostFocus Occurs this event when the object losts the focus Basic
KeyDown Occurs this event when user presses a key Basic
KeyUp Occurs this event when the user releases a key that previously pressed Basic
KeyPress Occurs this event when user presses or releases a character key Basic
MouseWheel Occurs this event when user scrolls mouse wheel Basic
AfterCreate Occurs this event when all the controls has been created before displaying Self
BeforeClose Occurs this event before close the form. Returns False if doesn't allow to close, returns True or returns nothing if allow to close Self
BeforeDestroy Occurs this event before destroy this window. All the controls will be disable after destroy Self
Move Occurs this event when the position of window has been changed Self
Size Occurs this event when the size of form has been changed Self
Activate Occurs this event when the state of the window has been change to be active Self
Deactivate Occurs this event when the state of the window has been change to be deactivated Self
Idle Occurs this event when system is in idle state, user can do some processing for background. Returns False or returns nothing to disable this event to occur again. Returns True to enable to occur this event again Self
FirstActivate Occurs this event when first time to be active Self
TrayEvent Occurs this event when the try icon set by this form received mouse click event Self
Show Occurs this event when the form is displayed Self
Hide Occurs this event when hide form Self

 

EPL form also provides several very easy ways for you to create outstanding form with amazing effect. To set these effects only cost few steps, such as insert a picture, and change a property, even without write any code.

Module

The EPL Module is a form codes and functions container. For each form, its codes is all in a module, such as “FormModuleN”. For functions, module can stores them in it, and name a meaningful module name for represent a serials of functions.

Class

EPL is an OOP supported development environment, EPL Class is implemented of EPL-OOP. For details about EPL Class, please see Object-Oriented Programming chapter.

Resource

EPL Resource is for you to store and use binary data such as picture, sound and any binary file, the data type of resource is Bin.