Skip to main content

Using the BuildPageSetupMenu method with the ExpressBars menu system

Drop a TdxPrintStyleManager component on a form.

The ExpressBars Suite is used as your Menu/Toolbar system, if Advanced is assigned to the PreviewDialogStyle property of the currently active engine controller or dxPSEngine global object. This topic demonstrates how to populate a TdxBarPopupMenu with print styles available via the Print Preview dialog’s File | Page Setup sub menu.

Page Setup Menu

Assign the following code to the OnChangeCurrentStyle event handler (bliPrintStyles is a TdxBarListItem object):

var
  dxBarManager1: TdxBarManager;
  dxBarPopupMenu1: TdxBarPopupMenu;
//...
procedure TMyForm.dxPrintStyleManager1ChangeCurrentStyle(Sender: TObject)
begin
  bliPrintStyles.ItemIndex := dxPrintStyleManager1.CurrentStyleIndex;
end;

Assign the following code to the OnStyleListChanged event handler (bbDefinePrintStyles is a TdxBarButton object):

procedure TMyForm.dxPrintStyleManager1StyleListChanged(Sender: TObject)
begin
  dxComponentPrinter1.CurrentLink.BuildPageSetupMenu(bliPrintStyles, bbDefinePrintStyles, True);
end;