Last active
October 18, 2018 09:12
-
-
Save tbuschto/22cff2720901e37ee641f194ff6c95c8 to your computer and use it in GitHub Desktop.
LabeledInput, no databinding
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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