Add

concerns

 

The Add function adds another control to the collection at run time.

 

Syntax

Add(ProgID, ControlName, Left, Top, Width, Height, Visible, EventHandler, AllowedEvents, StyleTemplate)

Return value

Type

Description

 

Control

The newly created control container

 

Parameter

Use

Name

Type

Passing

Description

Required

ProgID

String

ByVal

ProgID of the control to add.
i.e. TCEButtons.Button

Required

ControlName

String

ByVal

Name of the new control

Required

Left

Double

ByVal

Position of the left edge in Twips

Required

Top

Double

ByVal

Position of the top edge in Twips.

Required

Width

Double

ByVal

Width in Twips

Required

Height

Double

ByVal

Height in Twips

Required

Visible

Boolean

ByVal

Visibility of the control

Required

EventHandler

String

ByVal

Name of a function which can be taken for generic event handling. If not used, pass empty string.

Required

AllowedEvents

String

ByVal

Events, allowed to be passed to EventHandler function or, if not used, pass empty string

Required

StyleTemplate

String

ByVal

ID of a style template from the properties of the knowledge base, or, if not used, pass empty string

 

 

Example:

 

Dim c As Control

 

c := F1.Controls.Add("TCEEdit.Edit", "MyEdit", 1000, 1000, 2000, 200, True, "GenericEvent", "KeyDown;KeyUp", "EDIT")

 

c.AlignRight := TCEServer.AlignHorizontal.AlignHorRight

c.Expression("Value", TCEServer.ControlPropertyTypes.ObjectProperty) := "Country"

The program code above is adding a new control of type TCEEdit.Edit in a form. The method, which is receiving the events of the control is named GenericEvent. This function is called for the events KeyDown and KeyUp. A style template EDIT of the properties of the knowledge base is used.

 

Definition of a function for generic event handling:

 

Function GenericEvent(ByVal EI As TCEServer.ControlEventInfo) As Void

  

End Function