CreateOnDemand

Applies to

Tab controls

Description

When CreateOnDemand is enabled, all controls on all tab pages of a Tab control are instantiated when the Tab control is created, but the Constructor event of controls on hidden tab pages is not triggered until the user views the tab page either by clicking on the tab page or by calling the SelectTab function (the SelectTab function sets the SelectedTab property). Until the Constructor event for a control has run, a graphical representation of the control is not created, and its handle is not available. Constructor events for controls on the selected tab page are always triggered when the Tab control is created.

A window opens more quickly if the creation of a graphical representation is delayed for tab pages with many controls. However, scripts cannot refer to a control on a tab page until its Constructor event has run and a graphical representation has been created.

Usage

In a painter

To set the CreateOnDemand property:

  • Select the CreateOnDemand check box on the General page of the tab control's Properties view.

In scripts

The CreateOnDemand property takes a boolean value. The following example specifies that graphical representations of tab pages are not created until the tab page is selected:

tab_1.CreateOnDemand = TRUE

For more information about using this property in scripts, see Using Tab Controls in a Window in Application Techniques.