How to use the tabris.Constraint function in tabris

To help you get started, we’ve selected a few tabris examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github eclipsesource / tabris-js / test / typescript / Constraint.fail.ts View on Github external
let percentValue: PercentValue = {percent: 50};

let siblingReferenceValue: SiblingReferenceValue = (x: Widget) => true;
let constraintArray: ConstraintArray = ['50%'];
constraintArray = ['50%', 0, 1];
let constraintLikeObject: ConstraintLikeObject = {};
constraintLikeObject = {reference: 10};
constraintLikeObject = {percent: 10};

// Constructor
let constraint: Constraint = new Constraint(new Percent(0));
constraint = new Constraint();
constraint = new Constraint(new Percent(0), 0, 0);
constraint = new Constraint(null, null);
constraint = new Constraint(undefined, undefined);
constraint = new Constraint((x: Widget) => true, 23);
constraint = new Constraint(new Percent(0), '0');
constraint = new Constraint('auto');
constraint = new Constraint(new Percent(0), 'auto');
constraint = new Constraint(percentValue, 0);

// Instance
let auto = constraint.offset as 'auto';
let percentLikeObject = constraint.reference as PercentLikeObject;
let stringArray = constraint.toArray() as [string, string];

// ConstraintValue
let constraintValue: ConstraintValue = null;
constraintValue = undefined;
constraintValue = {};
constraintValue = new Date();
github eclipsesource / tabris-js / test / typescript / Constraint.fail.ts View on Github external
// Related types
let num: number = 23;
let percent: Percent = new Percent(0);
let reference: SiblingReference|Percent = new Composite();
let widget: Widget = new Composite();
let percentValue: PercentValue = {percent: 50};

let siblingReferenceValue: SiblingReferenceValue = (x: Widget) => true;
let constraintArray: ConstraintArray = ['50%'];
constraintArray = ['50%', 0, 1];
let constraintLikeObject: ConstraintLikeObject = {};
constraintLikeObject = {reference: 10};
constraintLikeObject = {percent: 10};

// Constructor
let constraint: Constraint = new Constraint(new Percent(0));
constraint = new Constraint();
constraint = new Constraint(new Percent(0), 0, 0);
constraint = new Constraint(null, null);
constraint = new Constraint(undefined, undefined);
constraint = new Constraint((x: Widget) => true, 23);
constraint = new Constraint(new Percent(0), '0');
constraint = new Constraint('auto');
constraint = new Constraint(new Percent(0), 'auto');
constraint = new Constraint(percentValue, 0);

// Instance
let auto = constraint.offset as 'auto';
let percentLikeObject = constraint.reference as PercentLikeObject;
let stringArray = constraint.toArray() as [string, string];

// ConstraintValue
github eclipsesource / tabris-js / test / typescript / Constraint.fail.ts View on Github external
let percent: Percent = new Percent(0);
let reference: SiblingReference|Percent = new Composite();
let widget: Widget = new Composite();
let percentValue: PercentValue = {percent: 50};

let siblingReferenceValue: SiblingReferenceValue = (x: Widget) => true;
let constraintArray: ConstraintArray = ['50%'];
constraintArray = ['50%', 0, 1];
let constraintLikeObject: ConstraintLikeObject = {};
constraintLikeObject = {reference: 10};
constraintLikeObject = {percent: 10};

// Constructor
let constraint: Constraint = new Constraint(new Percent(0));
constraint = new Constraint();
constraint = new Constraint(new Percent(0), 0, 0);
constraint = new Constraint(null, null);
constraint = new Constraint(undefined, undefined);
constraint = new Constraint((x: Widget) => true, 23);
constraint = new Constraint(new Percent(0), '0');
constraint = new Constraint('auto');
constraint = new Constraint(new Percent(0), 'auto');
constraint = new Constraint(percentValue, 0);

// Instance
let auto = constraint.offset as 'auto';
let percentLikeObject = constraint.reference as PercentLikeObject;
let stringArray = constraint.toArray() as [string, string];

// ConstraintValue
let constraintValue: ConstraintValue = null;
constraintValue = undefined;
github eclipsesource / tabris-js / test / typescript / Constraint.fail.ts View on Github external
let constraintArray: ConstraintArray = ['50%'];
constraintArray = ['50%', 0, 1];
let constraintLikeObject: ConstraintLikeObject = {};
constraintLikeObject = {reference: 10};
constraintLikeObject = {percent: 10};

// Constructor
let constraint: Constraint = new Constraint(new Percent(0));
constraint = new Constraint();
constraint = new Constraint(new Percent(0), 0, 0);
constraint = new Constraint(null, null);
constraint = new Constraint(undefined, undefined);
constraint = new Constraint((x: Widget) => true, 23);
constraint = new Constraint(new Percent(0), '0');
constraint = new Constraint('auto');
constraint = new Constraint(new Percent(0), 'auto');
constraint = new Constraint(percentValue, 0);

// Instance
let auto = constraint.offset as 'auto';
let percentLikeObject = constraint.reference as PercentLikeObject;
let stringArray = constraint.toArray() as [string, string];

// ConstraintValue
let constraintValue: ConstraintValue = null;
constraintValue = undefined;
constraintValue = {};
constraintValue = new Date();

// Statics
Constraint.from();
Constraint.from(null);
github eclipsesource / tabris-js / test / typescript / Constraint.fail.ts View on Github external
let num: number = 23;
let percent: Percent = new Percent(0);
let reference: SiblingReference|Percent = new Composite();
let widget: Widget = new Composite();
let percentValue: PercentValue = {percent: 50};

let siblingReferenceValue: SiblingReferenceValue = (x: Widget) => true;
let constraintArray: ConstraintArray = ['50%'];
constraintArray = ['50%', 0, 1];
let constraintLikeObject: ConstraintLikeObject = {};
constraintLikeObject = {reference: 10};
constraintLikeObject = {percent: 10};

// Constructor
let constraint: Constraint = new Constraint(new Percent(0));
constraint = new Constraint();
constraint = new Constraint(new Percent(0), 0, 0);
constraint = new Constraint(null, null);
constraint = new Constraint(undefined, undefined);
constraint = new Constraint((x: Widget) => true, 23);
constraint = new Constraint(new Percent(0), '0');
constraint = new Constraint('auto');
constraint = new Constraint(new Percent(0), 'auto');
constraint = new Constraint(percentValue, 0);

// Instance
let auto = constraint.offset as 'auto';
let percentLikeObject = constraint.reference as PercentLikeObject;
let stringArray = constraint.toArray() as [string, string];

// ConstraintValue
let constraintValue: ConstraintValue = null;
github eclipsesource / tabris-js / test / typescript / Constraint.fail.ts View on Github external
constraintArray = ['50%', 0, 1];
let constraintLikeObject: ConstraintLikeObject = {};
constraintLikeObject = {reference: 10};
constraintLikeObject = {percent: 10};

// Constructor
let constraint: Constraint = new Constraint(new Percent(0));
constraint = new Constraint();
constraint = new Constraint(new Percent(0), 0, 0);
constraint = new Constraint(null, null);
constraint = new Constraint(undefined, undefined);
constraint = new Constraint((x: Widget) => true, 23);
constraint = new Constraint(new Percent(0), '0');
constraint = new Constraint('auto');
constraint = new Constraint(new Percent(0), 'auto');
constraint = new Constraint(percentValue, 0);

// Instance
let auto = constraint.offset as 'auto';
let percentLikeObject = constraint.reference as PercentLikeObject;
let stringArray = constraint.toArray() as [string, string];

// ConstraintValue
let constraintValue: ConstraintValue = null;
constraintValue = undefined;
constraintValue = {};
constraintValue = new Date();

// Statics
Constraint.from();
Constraint.from(null);
Constraint.from(undefined);
github eclipsesource / tabris-js / test / typescript / Constraint.fail.ts View on Github external
let widget: Widget = new Composite();
let percentValue: PercentValue = {percent: 50};

let siblingReferenceValue: SiblingReferenceValue = (x: Widget) => true;
let constraintArray: ConstraintArray = ['50%'];
constraintArray = ['50%', 0, 1];
let constraintLikeObject: ConstraintLikeObject = {};
constraintLikeObject = {reference: 10};
constraintLikeObject = {percent: 10};

// Constructor
let constraint: Constraint = new Constraint(new Percent(0));
constraint = new Constraint();
constraint = new Constraint(new Percent(0), 0, 0);
constraint = new Constraint(null, null);
constraint = new Constraint(undefined, undefined);
constraint = new Constraint((x: Widget) => true, 23);
constraint = new Constraint(new Percent(0), '0');
constraint = new Constraint('auto');
constraint = new Constraint(new Percent(0), 'auto');
constraint = new Constraint(percentValue, 0);

// Instance
let auto = constraint.offset as 'auto';
let percentLikeObject = constraint.reference as PercentLikeObject;
let stringArray = constraint.toArray() as [string, string];

// ConstraintValue
let constraintValue: ConstraintValue = null;
constraintValue = undefined;
constraintValue = {};
constraintValue = new Date();
github eclipsesource / tabris-js / test / typescript / Constraint.fail.ts View on Github external
let siblingReferenceValue: SiblingReferenceValue = (x: Widget) => true;
let constraintArray: ConstraintArray = ['50%'];
constraintArray = ['50%', 0, 1];
let constraintLikeObject: ConstraintLikeObject = {};
constraintLikeObject = {reference: 10};
constraintLikeObject = {percent: 10};

// Constructor
let constraint: Constraint = new Constraint(new Percent(0));
constraint = new Constraint();
constraint = new Constraint(new Percent(0), 0, 0);
constraint = new Constraint(null, null);
constraint = new Constraint(undefined, undefined);
constraint = new Constraint((x: Widget) => true, 23);
constraint = new Constraint(new Percent(0), '0');
constraint = new Constraint('auto');
constraint = new Constraint(new Percent(0), 'auto');
constraint = new Constraint(percentValue, 0);

// Instance
let auto = constraint.offset as 'auto';
let percentLikeObject = constraint.reference as PercentLikeObject;
let stringArray = constraint.toArray() as [string, string];

// ConstraintValue
let constraintValue: ConstraintValue = null;
constraintValue = undefined;
constraintValue = {};
constraintValue = new Date();

// Statics
github eclipsesource / tabris-js / test / typescript / Constraint.fail.ts View on Github external
let siblingReferenceValue: SiblingReferenceValue = (x: Widget) => true;
let constraintArray: ConstraintArray = ['50%'];
constraintArray = ['50%', 0, 1];
let constraintLikeObject: ConstraintLikeObject = {};
constraintLikeObject = {reference: 10};
constraintLikeObject = {percent: 10};

// Constructor
let constraint: Constraint = new Constraint(new Percent(0));
constraint = new Constraint();
constraint = new Constraint(new Percent(0), 0, 0);
constraint = new Constraint(null, null);
constraint = new Constraint(undefined, undefined);
constraint = new Constraint((x: Widget) => true, 23);
constraint = new Constraint(new Percent(0), '0');
constraint = new Constraint('auto');
constraint = new Constraint(new Percent(0), 'auto');
constraint = new Constraint(percentValue, 0);

// Instance
let auto = constraint.offset as 'auto';
let percentLikeObject = constraint.reference as PercentLikeObject;
let stringArray = constraint.toArray() as [string, string];

// ConstraintValue
let constraintValue: ConstraintValue = null;
constraintValue = undefined;
constraintValue = {};
constraintValue = new Date();

// Statics
Constraint.from();
github eclipsesource / tabris-js / snippets / layout-relative-position.jsx View on Github external
import {Composite, contentView, LayoutData, Constraint} from 'tabris';

// There are various ways to refer to other widgets in a constraint value,
// each applicable to string, array or Constraint constructor call expressions

const redbox = new Composite({
  left: 10, top: 10, width: 100, height: 100,
  background: 'red'
}).appendTo(contentView);

// you can refer to a sibling widget by reference ...

new Composite({
  id: 'bluebox',
  left: [redbox, 10], top: new Constraint(redbox, 10), width: 100, height: 100,
  background: 'blue'
}).appendTo(contentView);

// ... by id ...

new Composite({
  left: '#bluebox 10', top: ['#bluebox', 10], width: 100, height: 100,
  background: 'green'
}).appendTo(contentView);

// ... or by a symbolic reference to the preceeding sibling

new Composite({
  left: 'prev() 10', top: [LayoutData.prev, 10], width: 100, height: 100,
  background: 'yellow'
}).appendTo(contentView);