Tutorial

Getting Started with Macros

Macro Editor

User Interface

Menus and Toolbar

Editing Macros

Macro Debugging

How To

Using variables

Finding and modifying objects

Creating new page content

Asking for user input

Storing persistent data

Using binary data

Sorting objects

Macro menus

Bulleted and numbered lists

Sample Macros

Concepts

Expressions

Objects

Properties

Variables

Data Types

Arrays

Functions

Literals

Operators

Comments

Last updated on: September 02, 2024
Also available as a single HTML file

Onetastic Macro Documentation > Functions > Dialog Box Functions > DialogBox_AddButton

DialogBox_AddButton

Adds a custom button to a dialog box.

Syntax

void DialogBox_AddButton(
	DialogBox dialogBox, 
	String label, 
	String name)

Parameters

DialogBox dialogBox
The dialogBox to add the button to.
String label
A label for the button. If there is an ampersand (&) sign before a character in the label it becomes the button's accelerator key.
String name
Name of the button. When a dialog box is closed by clicking on this button, DialogBox_Show function will return the name of the button that was clicked.

Remarks

If no custom buttons are added to a dialog box, it will automatically have an "OK" button when it is displayed. Up to 4 buttons can be added to a dialog box. When the user clicks on a button the dialog box closes and DialogBox_Show function will return the name of the button that was clicked

Examples

$dialog = DialogBox_Create("Do you want to delete this page?") DialogBox_AddButton($dialog, "&Yes", "yes") DialogBox_AddButton($dialog, "&No", "no") if ("yes" == DialogBox_Show($dialog)) RemoveObject($page)

This will display the following dialog box:

Dialog box with custom button

After user clicks on one of the "Yes" and "No" buttons, DialogBox_Show function returns either "yes" or "no", the name of the button user clicked.

Reference

Statements

Hierarchy Objects

Page Objects

Other Objects

Functions

Array Functions

Color Functions

Data Store Functions

Date/Time Functions

Dialog Box Functions

Macro Execution Functions

Macro Menu Functions

Object Functions

Special Functions

String Functions

Window Functions