Skip to main content

Embedding Controls into Groups

  • 2 minutes to read

This topic provides an example of customizing a group so that it displays custom controls within its client area. It is supposed that before starting to follow this topic’s instructions you have an application open with a customized NavBar control on the form. The NavBar should have two groups as shown in the image below.

This example will add one more group to the NavBar control. The group’s client area will display two check boxes which can be used to show/hide other groups. The next image displays the result of following the instructions below.

Customize the NavBar control in this manner.

  • Right-click the NavBar control and choose the ExpressNavBar Editor… item of the context menu. This invokes the control’s Component editor. Click the Groups link within the dialog to display the list of available groups.

  • Click the button to add a new group to the control. Set the group’s name to ‘grCustomize‘.

  • Set the Caption property of the group to ‘Customize‘.

  • Select the container control that is within the group just created. Use the Object Inspector to set its Caption property to an empty string.

  • Drag two check box controls to the group’s container control. Set their names to ‘chbHelp‘ and ‘chbEdit‘ and captions to ‘Show Help Topics Group‘ and ‘Show Edit Group‘. Set the Checked property of both check boxes to True.

  • Write the following handlers for the check box OnClick event handlers.
procedure TfrmNavBarDemo.chbHelpClick(Sender: TObject);
begin
// change the visibility of the Help Topics group with
// respect to the check box state
  grHelpTopics.Visible := chbHelp.Checked;
end;
procedure TfrmNavBarDemo.chbEditClick(Sender: TObject);
begin
// change the visibility of the Edit group with
// respect to the check box state
  grEdit.Visible := chbEdit.Checked;
end;
  • Run the application. Click the check boxes to hide and show the corresponding groups. The image below displays the result.

See Also