MoSync 3.3
Button

Defines

#define MAW_BUTTON_TEXT   "text"
 Sets or gets the text that is displayed in the label.
#define MAW_BUTTON_TEXT_VERTICAL_ALIGNMENT   "textVerticalAlignment"
 Sets the vertical alignment of the text inside the button. If the widget's height is WRAP_CONTENT this property has no effect.
#define MAW_BUTTON_TEXT_HORIZONTAL_ALIGNMENT   "textHorizontalAlignment"
 Sets the horizontal alignment of the text inside the button. If the widget's width is WRAP_CONTENT this property has no effect.
#define MAW_BUTTON_FONT_COLOR   "fontColor"
 Sets the font color of the button's text.
#define MAW_BUTTON_FONT_SIZE   "fontSize"
 Sets the font size in points of the button's text.
#define MAW_BUTTON_FONT_HANDLE   "fontHandle"
 Sets the typeface and style in which the text should be displayed.

Detailed Description

The available widget properties for a MAW_BUTTON. See of Widget properties for more properties.


Define Documentation

#define MAW_BUTTON_TEXT   "text"

Sets or gets the text that is displayed in the label.

Valid values
A null-terminated string.
Operations
Set and get.
Example set
        maWidgetSetProperty(buttonHandle, MAW_BUTTON_TEXT, "My button");
Example get
        char textBuffer[BUFFER_SIZE];
        int result = maWidgetGetProperty(buttonHandle, MAW_BUTTON_TEXT, textBuffer, BUFFER_SIZE);
        if (result > 0)
        {
        // Do something with the label text.
        }
#define MAW_BUTTON_TEXT_VERTICAL_ALIGNMENT   "textVerticalAlignment"

Sets the vertical alignment of the text inside the button. If the widget's height is WRAP_CONTENT this property has no effect.

Valid values
One of the constants MAW_ALIGNMENT_TOP, MAW_ALIGNMENT_CENTER or MAW_ALIGNMENT_BOTTOM.
Operations
Set only.
Example
#define MAW_BUTTON_TEXT_HORIZONTAL_ALIGNMENT   "textHorizontalAlignment"

Sets the horizontal alignment of the text inside the button. If the widget's width is WRAP_CONTENT this property has no effect.

Valid values
Takes one of the constants MAW_ALIGNMENT_LEFT, MAW_ALIGNMENT_CENTER or MAW_ALIGNMENT_RIGHT.
Operations
Set only.
Example
#define MAW_BUTTON_FONT_COLOR   "fontColor"

Sets the font color of the button's text.

Valid values
A hexadecimal value 0xRRGGBB, where R, G and B are the red, green and blue components respectively.
Operations
Set only.
Example
        maWidgetSetProperty(buttonHandle, MAW_BUTTON_FONT_COLOR, "0xff0000");
#define MAW_BUTTON_FONT_SIZE   "fontSize"

Sets the font size in points of the button's text.

Valid values
A float that specifies the number of pixels on Android and WP7, and number of points on iOS.
Operations
Set only.
Example
        maWidgetSetProperty(buttonHandle, MAW_BUTTON_FONT_SIZE, "13.0");
#define MAW_BUTTON_FONT_HANDLE   "fontHandle"

Sets the typeface and style in which the text should be displayed.

Valid values
A font handle received from loading fonts using maFontGetName and maFontLoadWithName syscalls.
Operations
Set only.
Example
        int nrFonts = maFontGetCount();
         char buf[256];
         // Get first font name.
         maFontGetName(1, buf, 256);
         // Load that font for size 10.
         int fontHandle = maFontLoadWithName(buf, 10);
         // Set that font to the label.
        maWidgetSetProperty(buttonHandle, MAW_BUTTON_FONT_HANDLE, toString(fontHandle));
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines