Im a newb,
Just starting trying to add simple text buttons etc to the sidebar view of a widget.
Here's the snippet of code I'm using to make a button:
this.controls.button1 = new KONtx.control.TextButton({
guid: "button0",
label: $_('view_0'),
styles: {
color:"#000000",
background:"#e28d45",
fontSize: KONtx.utility.scale(20),
vAlign: "center",
hAlign: "center"
},
events: {
onSelect: function(event) {
KONtx.application.loadView('view-Settings');
}
}
}).appendTo(this);
Works fine, but no matter what I try the text remains the default white rather than the requested Black. Any ideas?

For styling the button text, you need to pass "textStyles" attribute. The default styles used are mentioned in the theme.js file:<br><br>Theme.storage.add('ControlTextButtonText', {<br> //<br> styles: {<br> hOffset: 5,<br> width: Theme.keys.sidebar.width - 10,<br> truncation: 'end',<br> vAlign: 'center',<br> color: Theme.colors.text,<br> fontFamily: Theme.fonts.regular,<br> fontSize: 16,<br> paddingBottom: 1<br> }<br> //<br>});<br><br>So you can just copy everything as it is but change the color and you should have the desired text color.<br><br>this.controls.button1 = new KONtx.control.TextButton({<br> guid: "button0",<br> label: $_('view_0'),<br> styles: {<br> background:"#e28d45",<br> ..<br> },<br> textStyles:{<br> hOffset: 5,<br> width: Theme.keys.sidebar.width - 10,<br> truncation: 'end',<br> vAlign: 'center',<br> color: "#000000",<br> fontFamily: Theme.fonts.regular,<br> fontSize: 16,<br> paddingBottom: 1<br> }<br> ..<br> }).appendTo(this);<br><br>Thanks,<br>Vivek

Thank you so much!<br><br>For anyone attempting to cut and paste this code to adjust text styles, be aware due to encoding some characters may cause a crash in your simulator. Better to type by hand! But otherwise Viveks code worked for me :)<br><br> QUOTE (Vivek Jani @ 23 Jan 2012 1:28 AM) For styling the button text, you need to pass "textStyles" attribute. The default styles used are mentioned in the theme.js file:<br><br>Theme.storage.add('ControlTextButtonText', {<br> //<br> styles: {<br> hOffset: 5,<br> width: Theme.keys.sidebar.width - 10,<br> truncation: 'end',<br> vAlign: 'center',<br> color: Theme.colors.text,<br> fontFamily: Theme.fonts.regular,<br> fontSize: 16,<br> paddingBottom: 1<br> }<br> //<br>});<br><br>So you can just copy everything as it is but change the color and you should have the desired text color.<br><br>this.controls.button1 = new KONtx.control.TextButton({<br> guid: "button0",<br> label: $_('view_0'),<br> styles: {<br> background:"#e28d45",<br> ..<br> },<br> textStyles:{<br> hOffset: 5,<br> width: Theme.keys.sidebar.width - 10,<br> truncation: 'end',<br> vAlign: 'center',<br> color: "#000000",<br> fontFamily: Theme.fonts.regular,<br> fontSize: 16,<br> paddingBottom: 1<br> }<br> ..<br> }).appendTo(this);<br><br>Thanks,<br>Vivek