Control.setSize

Syntax

setSize(Width, Height);

Parameters

Width. Component width in pixels.

Height. Component height in pixels.

Description

The setSize method sets the sizes of the component.

Example

To execute the example, link the PP.js library and the PP.css visual styles table to HTML page.

Create two buttons: an instance of the Button class named MyButton and the HTML button named Change Size, clicking which changes the size of the first button.

<div id = "btn1"></div>
<br/>
<button onclick = "b1.setSize(50,100);">Resize</button>//create a button that calls //the setSize() method
<script type="text/javascript">
     var b1 = new PP.Ui.Button({
         ParentNode: document.getElementById("btn1"),
         Content: "MyButton"})
</script>

After executing the example on pressing the Change size button the MyButton button becomes 50x100 pixels.

See also:

Control