new Button(option)
A class for button components.
Parameters:
| Name | Type | Description |
|---|---|---|
option |
Object | option is properties set for components. |
- Since:
-
- 2.0.0
Example
var Button = caph.require('caph.stripe.ui.component.Button');
var Icon = caph.require('caph.stripe.ui.component.Icon');
var button = new Button({ //Text type button
'contents' : 'ButtonText',
'position' : [350, 220],
'size' : [170,50],
'dom' : {
'opacity' : 0.5
}
});
var iconButton = new Button({ //icon type button
'contents' : Icon.bgm(),
'position' : [600, 300]
'size' : [200, 300],
});
Extends
- caph.ui.base.component.Button
Methods
-
setContent(contents)
-
Set the button's contents
Parameters:
Name Type Description contentsString | caph.ui.base.component.Icon | Object | caph.module.renderer.View contents is String which set for button's contents or Icon or View.
Contents Type
String, Iconcaph.ui.base.component.Icon, View caph.module.renderer.View,
{
icon : caph.ui.base.component.Iconcaph.ui.base.component.Icon,
text : String
}- Since:
-
- 2.0.0
Example
var textButton = new Button({ contents : 'Button' }); //button text is changed to 'Click this' textButton.setContent('Click this'); var iconButton = new Button({ contents : Icon.ff() }); //button content is changed to BGM icon. iconButton.setContent(Icon.BGM()); -
setOption(option)
-
Sets this object's own properties with the given option.
Parameters:
Name Type Description optionObject A set of button's properties.
- Since:
-
- 2.0.0
Example
var Button = caph.require('stripe.ui.component.Button'); //Button Class var button = new Button(); //Empty Button //Set button's contents, align and style. button.setOption({ contents : 'Click me', align : 'center | middle', position : [100, 100], size : [200, 100] });