Search
Unit.pixel Method
See Also
 






Creates a Unit instance with the specified value and UnitType.Pixel.

Namespace: MindFusion.Common
File: Unit.js

 Syntax

JavaScript  Copy Code

function pixel (value)

 Parameters

value

Number. The value of the unit.

 Return Value

Unit. The new Unit.

 Example

The following code creates a new ListView and specifies its size in Unit.pixel.

JavaScript  Copy Code

var ui = MindFusion.UI;

var listView;
var host;
var theme = "gray";

document.addEventListener("DOMContentLoaded", function ()
{
   listView = new ui.ListView(document.getElementById("listView"));
   listView.minWidth = ui.Unit.empty();
   listView.width = listView.height = ui.Unit.pixel(100);
   listView.theme = theme;
   listView.itemSize = ui.Unit.pixel(100);
   listView.itemDoubleClick.addEventListener(handleItemDoubleClick);

   ..........................................
   ..........................................
}

 See Also