Button Object

Synopsis

Class Name: Button
Valid Parents: Bulletin, Dialog, Menu, Popup
Valid Children: Popup

Description

A push button which initiates an operation when pressed.

  • Buttons are used for the majority of items in a menu.
  • Many dialogs have OK, Apply and Cancel buttons.

Inherited Resources

New Resources

Name Type Default
XuNguiCallback string undef
XuNguiCallbackData string undef
  • XuNguiCallback specifies the name of the function to call when the button is pressed.
  • If XuNguiCallbackData is specified then the value is passed to the callback function in the second argument.
  • For more details - see Callback Functions
Name Type Default
XuNguiMnemonic string undef
  • A single character which can be used with Alt as a keyboard shortcut to activate the button. The mnemonic character is underlined in the label.

Callback Information

Reason Event
XuCR_ACTIVATE MB1 pressed and released with pointer inside the object


Example Code

  function ButtonPressedCB(string o, string d, float r)
    echo("Your button was pressed");
  endfunction
 
  create Dialog gsharp_1.mydialog
   ( XuNguiDialogType = "template"
   );
  create Bulletin gsharp_1.mydialog.Bulletin;
  create Button gsharp_1.mydialog.Bulletin.Button1
   ( XuNguiPosition = (10,10),
     XuNguiLabel = "My Button",
     XuNguiWidth = 100,
     XuNguiHeight = 100,
     XuNguiCallback = "ButtonPressedCB"
   );
  GuiPopupDialog("gsharp_1.mydialog");

Return to Gsharp Applications Reference Manual