EAGLE Help Light

dlgPushButton

Funkce
Defines a push button.

Zápis
dlgPushButton(string Text) statement

Description
The dlgPushButton statement defines a push button with the given Text.

If Text contains an '&', the character following the ampersand will become a hotkey, and when the user hits Alt+hotkey, the button will be selected. To have an actual '&' character in the text it has to be escaped.

If Text starts with a '+' character, this button will become the default button, which will be selected if the user hits ENTER.
If Text starts with a '-' character, this button will become the cancel button, which will be selected if the user closes the dialog.
CAUTION: Make sure that the statement of such a marked cancel button contains a call to dlgReject()! Otherwise the user may be unable to close the dialog at all!
To have an actual '+' or '-' character as the first character of the text it has to be escaped.

If the user selects a dlgPushButton, the given statement is executed.
Before the statement is executed, all variables that have been used with dialog objects are updated to their current values, and any changes made to these variables inside the statement will be reflected in the dialog when the statement returns.

Viz také Layout Information, Dialog Functions, A Complete Example

Příklad


int defaultWidth = 10;
int defaultHeight = 20;
int width = 5;
int height = 7;
dlgPushButton("&Reset defaults") {
  width = defaultWidth;
  height = defaultHeight;
  }
dlgPushButton("+&Accept") dlgAccept();
dlgPushButton("-Cancel") { if (dlgMessageBox("Are you sure?", "Yes", "No") == 0) dlgReject(); }


OBSAH Translation © 2001 ELCAD v.o.s., Copyright © 2001 CadSoft Computer GmbH