2.2.1 Visual LANSA's Components
Visual LANSA has the following types of components:
-
Fields. Any LANSA field you use in an application becomes a component.
-
Forms. A form corresponds to a window of an application.
-
Controls. These are the graphical widgets put on the form. Examples of controls are command buttons, list boxes, videos, labels, tree views, radio buttons and track bars. See 2.9 Controls for details.
-
Reusable parts. These parts contain controls and code which can be reused in forms (or other reusable parts).
-
Visual Styles. This is a special kind of component which controls the appearance of individual fields, forms and controls or entire applications.
-
Bitmaps and icons. These are images which are shared by many applications.
-
ActiveX controls. These are third party standard reusable components.
-
WAMs. These components use XML to deliver technology services for a variety of client computing devices, including browsers.
Component Properties
All Visual LANSA components have properties which define their characteristics. Most properties deal with the way a component is displayed on the screen: its size, color, and whether it is visible or not. You can set the properties when you are designing your application, or programmatically when the application is running. Often you do not need to change any of the default property values.
Component Events
Traditional LANSA functions (Universal UI) implement procedural programming method, Visual LANSA applications are event-driven.
The main difference in writing Visual LANSA applications compared to traditional LANSA functions is that in Visual LANSA the code belongs to the various controls on the form instead of a single function. This code is run when the user performs an action on the control, for example clicks a button. This is called event-driven programming.
An event is a thing that happens or takes place. Typically an event is any action the user takes. The most common event is click (when the user clicks on a component with the mouse). You could for example define a button 'Print' and write code for the button's click event to print something. When the application is running, every time your user clicks on the Print button the print routine will be executed.
Other common events are:
-
Initialize. This event is triggered when a component is first displayed.
-
GotFocus and LostFocus. This event is triggered when the user selects a component with the mouse.
-
Change. This event happens when the user changes the contents of component, for example a field.
For more information, refer to Event-Driven Programs.
Component Methods
A method is how you tell a component to do something. For example to display a form, you use the ShowForm method:
INVOKE #FormB.ShowForm
You can also define custom methods to make a component perform an action.
Also see