Button

Button definition: properties, methods, events and examples.

The UI.Button is used to display a single button.

Examples:

<?php

/**
 * Button control example.
 * mainButton.php
 */
 
$win = new SDPanel();
$win->setCaption("Button control");
 
$tabMain = new Table();
 
$button = new Button();
$button->setCaption("Button");
$button->setClass("button.Example");
$button->onTap(action());
 
$tabMain->addControl($button,1,1);
$win->addControl($tabMain);
 
function action(){
	echo "Hello world!";
}
 
?>

Properties:

  • width : Number
    Buttons's width, in platform-specific units.
  • height : Number
    Buttons's height, in platform-specific units.
  • caption : String
    The text of the button.
  • visible : Boolean
    Determines whether the button is visible or not.
  • enable : Boolean
    Determines whether the button is enabled or disabled.
  • className : Class
    Class defined in .css stylesheet
  • image : String
    Image for the button, specified as a local file path. ie. "img/icon_40x40.png"
  • imagePoistion : Position.
    Buttons's image position. ie. "Above text"
  • invisibleMode : PositionMode
    Determines view behaviour if button is not visible ie. "Keep Space" or "Collapse Space"

Methods:

  • setWidth( width )
    Sets the value of the width property.
  • setHeigth( height )
    Sets the value of the height property.
  • setCaption( caption )
    Sets the text of the button.
  • setVisible( visible )
    Sets the value of the visible property.
  • setEnabled( enable )
    Sets the value of the enabled property.
  • setClass( className )
    Set style class for the button.
  • setImage( image )
    Sets the value of the button image property.
  • setImagePosition( imagePoistion )
    Sets the value of the button image position property.
  • setInvisibleMode( invisibleMode )
    Sets the value of the button invisible mode property.

Events:

  • onTap( callBack )
    Fired when the device detects a long tap against element.
    • Parameters
      • callBack : Function
        Function to invoke when the event is fired.
    • Return : void

Download code example

Rate This Article

(0 out of 0 people found this article helpful)