Windows Form

The EPL will add a form named “_MainForm” automatically to your application when you create a new Windows Form Application. The EPL Windows Form provides most common programming elements for windows GUI application, it contains properties, methods and events.

To add a new form, you can click “Insert” -> “Form” menu. And the name of new adding form will be auto-named.

Form Basic Property

The basic property of form/control is provided by EPL system, not by the form/control themselves. In the form/control properties list, the basic properties are showed in top of the list, the self-provided properties of form/control are showed in the bottom, they separate with a bold line. The main difference between basic and self-provided property is the basic property will be valid before the form/control is created, but self-provided properties won’t.

EPL

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
Focus Sets whether the focus can stay on this form/control when user use Tab key or cursor switch the inputting focus
TabOrder This property is only valid when “Focus” property is True. It’s the order that user switch the inputting focus by Tab key or cursor. When the form is loaded, inputting focus will switch to the control that has the minimal TabOrder

Form Basic Events

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

“System Basic-Events” is provided by the system, all the 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

 

LButtonDown

EPL

 

LButtonUp

EPL

 

DblClick

EPL

 

RButtonDown

EPL

 

RButtonUp

EPL

 

MouseMove

EPL

 

The parameters of the events (LButtonDown, LButtonUp, DblClick, RButtonDown, RButtonUp, MouseMove) are

x: Indicates the Horizontal position of the mouse pointer in control coordinates

y: Indicates the vertical position of the mouse pointer in control coordinates

FunctionKeyState: Used to check determine whether each key is down. Can be one of the following constants or their summation: 1,#CtrlKey; 2,#ShiftKey; 4,#AltKey. Use "And" command to check specified key is down. Means specified key is down if return nonzero value

 

KeyDown

EPL

 

KeyUp

EPL

 

The parameters of the events (KeyDown, KeyUp) are

KeyCode: Key constants, like: "F1Key", "EnterKey" etc. Check constants list of library to retrieve value of specified key

FunctionKeyState: Same as previous.

The events (LButtonDown, LButtonUp, DblClick, RButtonDown, RButtonUp, MouseMove, KeyDown, KeyUp) should return a Boolean type value. If returns False, just cancel this event, and doesn’t post the event the event-container any more; if returns True or not return, post this event to the event-container that the event belongs to.

 

GetFocus

EPL

 

LostFocus

EPL

 

KeyPress

EPL

Character keys includes all the printable characters, Enter and Backspace. If returns False, this event is canceled; the event is passed if returns True or does not return. The CharCode event parameter indicates corresponding character code of key with down state, retrieves specified character by "Chr" function

 

MouseWheel

EPL

Form Method

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

Add/Delete Form

To add a new form to application, you can click “Insert” ->”Form” menu. See picture below

 

GetFocus

EPL

 

To delete a form, you can activate the Application tab of Workspace tabs, and right-click to activate the form item you want to delete and popups a menu, finally click “Delete Form” on the menu

EPL

Load/Destroy Form

All the forms must load by “Load()” function, except the form “_MainForm” that set to automatically load as starting mode. After a form is loaded, all the property of form changed will be restored to original designing status after destroy it. But if the property of form or control is static, the changed property won’t be restored, and keep it always.

All the loaded forms must be destroyed if you don’t need it anymore. To destroy, you can call “Destroy” method of form.

Menu

Add/Edit Menu

To add menus to a form, you can use the Menu Editor. First activate a from when design and click “Tools” ->”Menu Editor” menu or directly press “Ctrl + E” keys.

To add new menu items, you can click “Insert Before” or “Insert After” button.

To change menu items’ layer, you can click “Move Left” or “Move Right” button.

To change menu items’ position, you can click “Move Up” or “Move Down” button.

EPL

 

Hot Key & Shortcut Key

To set a Hot Key to a menu item, you just click on a menu item, and add a “&” mark before the word that you want to set as hot key.

To set a Shortcut Key to a menu item, you just click on a menu item, and choose a key in “Shortcut” drop down list. See picture below

EPL

 

Checked

Use this attribute, you can set a menu item to be checked or not. The checked menu item will appear as a √ mark.

 

Enabled

Use this attribute, you can enable or disable a menu item, the disabled menu item will appear in gray color, and can’t be operated.

 

Visible

Use this attribute, you can show or hide a menu item.

 

Receive Click Event

All the non-top level menu items can receive a Click event.

 

Control The Menu

You can also write code to control the menu, all the menu items have the name you pre-named in Menu Editor, you just use the name and a “.” mark to operate every properties of the menu item, such as if the “mnuSave” is the name of a menu item, you can call

 

        mnuSave.Visible = False

 

to hide the menu item

 

Popup Menu

You can call “PopupMenu” function to display the menu at the specified position or the current mouse position. Automatically use its container form if called object is window control.

Notice that, don’t forget click OK button to confirm all the changing of the menu after you finish to edit menu, otherwise all the changing will be discarded.

MsgBox & InputBox

The MsgBox() and InputBox() function are very common used functions, actually the MsgBox() is just like Windows API MessageBox().

 

MsgBox function

 

      MsgBox (All Prompt, Integer CommandButton, [String Caption])

The MsgBox function shows a message box. The return value indicates which button is pressed. 0,#OK; 1,#Cancel; 2,#Abort; 3#Retry; 4,#Ignore; 5,#Yes; 6,#No. ESC key has the same effect with Cancel button.

The following describes parameters of this function

Parameter Type Description
GetHWnd All This parameter can be only String, Number, Boolean or DateTime. If the prompt contains multi-lines of texts, you can use carriage return character (Chr(13), Chr(10) or (Chr13) + Chr(10)) to separate each lines
CommandButton Integer This parameter can be a combination of constants of the following groups of constants. Only one value can be used from one group (except group 5):
Group 1 (Buttons):
0,#ButtonOK; 1,#ButtonOKCancel; 2,#ButtonAbortRetryIgnore;
3,#ButtonCancelYesNo; 4,#ButtonYesNo; 5,#ButtonRetryCancel
Group 2 (Icons):
16,#IconError;32,#IconQuestion;48,#IconWarning;
64,#IconInformation
Group 3 (Default button):
0,#DefaultButton1; 256,#DefaultButton2; 512,#DefaultButton3;
768,#DefaultButton4
Group 4 (Modal):
0,#TaskModal; 4096,#SystemModal
Group 5(Others):
65536, #TopMost; 524288,#RightAlign
Caption All This parameter can be ignored. Specifies the caption of the dialog. The default caption is "Information".

 

InputBox function

 

  InputBox ([String Prompt],[String Caption],[String InitString],All Buffer,[Integer InputMode])

The InputBox function displays an input dialog to receive the input of user. Returns True if OK button(or Enter key) is pressed, otherwise False.

The following describes parameters of this function,

Parameter Type Description
Prompt String If the prompt contains multi-lines of texts, you can use carriage return character (Chr(13), Chr(10) or (Chr13) + Chr(10)) to separate each lines. If the string is too long or has too much lines, possibly the contents can't display completely
Caption String This parameter can be ignored. Specifies the caption of the dialog. The default caption is "Please input".
InitString String Specifies the initial content of the TextBox
Buffer All Only variable is accepted. The parameter can be Number or String type to retrieve input-data of different types
InputMode Integer This parameter can be ignored. Can be one of the following constants: 1,#InputString; 2,#InputInteger; 3,#InputDouble; 4,#InputPassword. The default value is #String