Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

How to Add a Dialog Launcher to the Ribbon Tab Group in Code

The following example demonstrates how to add a dialog launcher button to the Ribbon tab group programmatically.

Delphi
//...
type
  TRibbonDemoMainForm = class(TdxRibbonForm)
    BarManager: TdxBarManager;
    BarManagerBar5: TdxBar;
    dxBarScreenTipRepository1: TdxBarScreenTipRepository;
    procedure FontClick(Sender: TObject);
//...
var
  STBitmap: TBitmap;
//...
// ------------------------------------------------
// Provide implementation for the dialog launcher's OnClick event
// ------------------------------------------------
procedure TRibbonDemoMainForm.FontClick(Sender: TObject);
begin
  FontDialog.Font.Assign(Editor.SelAttributes);
  if FontDialog.Execute then
    Editor.SelAttributes.Assign(FontDialog.Font);
end;
//...
// ------------------------------------------------
// Create a new ScreenTip for the dialog launcher button
// ------------------------------------------------
var
  stFontDialog: TdxBarScreenTip;
begin
  stFontDialog := dxBarScreenTipRepository1.Items.Add;
  with stFontDialog do
  begin
    Header.Text := 'Font Dialog';
    Description.Glyph := STBitmap;
    Description.Text := 'Show the Font dialog box';
  end;
end;
//...
// ------------------------------------------------
// Create a new dialog launcher button with required attributes
// ------------------------------------------------
with BarManagerBar5.CaptionButtons.Add do
begin
  KeyTip := 'FN';
  ScreenTip := stFontDialog;
  OnClick := FontClick;
end;
//...
initialization
  STBitmap := TBitmap.Create;
  STBitmap.LoadFromFile('FontDlgIcon.bmp');
end.

The following image shows the dialog launcher button’s KeyTip and ScreenTip:

The following image shows the button’s event handler execution result, after the button has been clicked:

See Also