Skip to content

Instantly share code, notes, and snippets.

@tbuschto
Last active October 18, 2018 09:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tbuschto/22cff2720901e37ee641f194ff6c95c8 to your computer and use it in GitHub Desktop.
Save tbuschto/22cff2720901e37ee641f194ff6c95c8 to your computer and use it in GitHub Desktop.
LabeledInput, no databinding
import { ui, Composite } from 'tabris';
import { component, ComponentJSX } from 'tabris-decorators';
// ------------ Component ------------
@component
export default class LabeledInput extends Composite {
private jsxProperties: ComponentJSX<this>;
constructor(properties: Partial<LabeledInput>) {
super(properties);
this.append(
<widgetCollection>
<textView id='label'
height={32} centerY={0}
text='Label:'
font='20px'/>
<textInput id='input'
left='prev() 12' width={250}
font='20px'/>
</widgetCollection>
);
}
}
// ---------- Example App ------------
ui.contentView.append(
<widgetCollection>
<LabeledInput id='input'/>
<LabeledInput id='anotherInput'/>
<LabeledInput id='lastInput'/>
</widgetCollection>
).children().set({left: 12, top: 'prev() 12'});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment