Frequently Asked Component Specific Questions

Options

Display all FAQ items

Search FAQ items:


Displaying items 1 to 1 of 1, page 1 of 1

<< previous next >>

TMS Advanced Toolbars & Menus
Programmatically adding page, toolbar and button to the ribbon

Following code snippet illustrates how you can add a new page with a new toolbar and a new button via code to the Office 2007 ribbon control. To test this, drop a TAdvToolBarPager on the form and add following code:
var
  AdvPage: TAdvPage;
  AdvToolBar: TAdvToolBar;
  AdvGlowButton: TAdvGlowButton;
begin
  AdvPage := TAdvPage.Create(self);
  AdvPage.Caption := 'New page';
  AdvPage.AdvToolBarPager := AdvToolBarPager1;

  AdvToolBarPager1.ActivePageIndex := AdvToolBarPager1.AdvPageCount - 1;

  AdvToolBar := TAdvToolBar.Create(self);
  AdvToolBar.Parent := AdvPage;
  AdvToolBar.Caption := 'New toolbar';

  AdvGlowButton := TAdvGlowButton.Create(Self);

  AdvGlowButton.Parent := AdvToolBar;
  AdvGlowButton.Caption := 'New Button';
  AdvGlowButton.ShowCaption := true;
end;