This section describes the functions that a concrete control class should implement so that it can be constructed.
Different functions are used to construct a control, depending on if it is:
a window-owning control
a compound control or a simple control
The following sections describe each of the different cases. Each section begins by describing how the control is created by the application, and uses this to list the functions that the control needs to implement.
Note that device families may impose other requirements on control creation for use in dialogs.
To do this, an application has to:
Allocate memory for the control, and call its C++ constructor
— this is done by calling new(ELeave)
on the control
class.
Set the control's associated
window — this is done using
SetContainerWindowL()
.
The only construction function the control needs to implement in
this case is its C++ constructor. This can be used to initialise
control-specific data, and to call non-leaving functions that affect the
control for its whole lifetime, such as SetNonFocusing()
.
A control of this type, whose construction involves functions that
can leave, should also code a ConstructL()
function to handle all
aspects of initialisation that can leave.
To do this, the application has to:
Allocate memory for the control, and call its C++ constructor.
If the control is a non-window-owning control, set its
associated window, by calling
SetContainerWindow()
or SetContainerWindowL()
.
Complete the control's construction by calling
ConstructL()
.
Activate the control by calling ActivateL()
,
unless the control is a component inside a compound control. In this case,
there is no need to call ActivateL()
explicitly, because when a
compound control is activated, it also activates all its component
controls.
The functions that the control needs to implement are its C++
constructor, and ConstructL()
. ConstructL()
is the
control's second-phase constructor and should contain all initialisation that
might leave. Typically, ConstructL()
will:
call CreateWindowL()
or
CreateBackedUpWindowL()
if the control is a window-owning
control
initialise the control's extent, unless this is done by the control's container
create its component controls, if it is a compound control
The derived control class may optionally override
ActivateL()
.