View on GitHub

UI-with-Classes

Collection of 4D classes dedicated to user interface management, designed to structure the UI and make code more readable, maintainable, and reusable.

dimensions

The dimensions class provides an interface for manipulating width and height values of a widget.

This class is available from the cs class store, or cs.ui class store if you use the UI component.


cs.dimensions.new()

cs.dimensions.new( widget : Object ) : cs.dimensions
cs.dimensions.new( name : Text ) : cs.dimensions
cs.dimensions.new( width : Integer; height : Integer ) : cs.dimensions
cs.dimensions.new() : cs.dimensions

Parameter Type   Description
widget Object A widget class object like cs.static, cs.input, cs.button
name Text Widget name
width Integer Width in pixels
height Integer Height in pixels
result cs.dimensions New cs.dimensions

Description

cs.dimensions.new() creates and returns a new class instance.

Properties

Properties Description Type Writable
.width Width in pixels Integer
.height Height in pixels Integer

Functions

Functions  
.area() → Integer Returns width * height
.perimeter() → Integer Returns (width + height) * 2

Compatibility Note

cs.dimensions is introduced as a transition companion to cs.rect.