Instant properties: isempty

The instant property isempty represents the status of a rect, styles or user-defined set operand.

Declaration

Form 1:

bool rect.isempty

Form 2:

bool styles.isempty

Form 3:

bool user‑defined‑set.isempty

Discussion

The first version of the isempty instant property is used in context of a rect operand. The read access to this property results in a boolean value true or false depending on whether the rectangle is empty or not. A rectangle is empty if its width or height is <= 0. Please note, this property is read-only. The write access to this property is not allowed. For example:

var rect r1 = <100,200,110,220>; var rect r2 = <100,200,100,220>; var rect r3 = <100,200,110,180>; // Test the rectangle whether it is empty var bool result = r1.isempty; // result = false var bool result = r2.isempty; // result = true var bool result = r3.isempty; // result = true // Modification is not allowed r1.isempty = true; // Chora compiler error

The second version of the isempty instant property is used in context of a styles operand. Operands of the styles data type can be considered as collections able to manage multiple elements you can individually include or exclude. The read access to the property isempty results in a boolean value false or true depending on whether the operand contains at least one element or it is completely empty. Please note, this property is read-only. The write access to this property is not allowed. For example:

var styles s1 = [ Style1, Style3, Style16 ]; var styles s2 = [ Style3 ]; var styles s3 = []; var bool result = s1.isempty; // result = false var bool result = s2.isempty; // result = false var bool result = s3.isempty; // result = true // Modification is not allowed s1.isempty = true; // Chora compiler error

The third version of the isempty instant property is used in context of a user-defined set operand. Operands of the set data type can be considered as collections able to manage multiple elements you can individually include or exclude. The read access to the property isempty results in a boolean value false or true depending on whether the operand contains at least one element or it is completely empty. Please note, this property is read-only. The write access to this property is not allowed. For example:

var Core::Layout s1 = Core::Layout[ AlignToLeft, AlignToTop, ResizeHorz ]; var Core::Layout s2 = Core::Layout[ ResizeHorz ]; var Core::Layout s3 = Core::Layout[]; var bool result = s1.isempty; // result = false var bool result = s2.isempty; // result = false var bool result = s3.isempty; // result = true // Modification is not allowed s1.isempty = true; // Chora compiler error