[TIMOB-10252] TiAPI: Button/label: Add wordWrap, textPadding, titlePadding
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | Medium |
Status | Closed |
Resolution | Won't Fix |
Resolution Date | 2014-04-28T20:59:47.000+0000 |
Affected Version/s | Release 3.0.0 |
Fix Version/s | n/a |
Components | TiAPI |
Labels | api |
Reporter | Martin Guillon |
Assignee | Vishal Duggal |
Created | 2012-07-26T04:49:59.000+0000 |
Updated | 2019-07-26T15:46:18.000+0000 |
Description
I added
Button:
- shadowColor
- shadowOffset
- wordWrap
- verticalAlign
- titlePaddingLeft,titlePaddingTop, titlePaddingBottom, titlePaddingRight
Label:
- shadowColor
- shadowOffset
- textPaddingLeft,textPaddingTop, textPaddingBottom, textPaddingRight
TestCase
var win = Ti.UI.createWindow({
backgroundColor: 'white',
layout:'vertical'
});
var button = Ti.UI.createButton({
top:10,
width:100,
height:50,
shadowColor:'#ddff0000',
shadowOffset:{x:2,y:2},
wordWrap:true,
title:'This is a test button'
});
win.add(button);
button = Ti.UI.createButton({
top:10,
width:100,
height:50,
shadowColor:'#5500ff00',
shadowOffset:{x:-2,y:0},
wordWrap:false,
title:'This is a test button'
});
win.add(button);
button = Ti.UI.createButton({
top:10,
width:100,
height:50,
shadowColor:'#ddff0000',
shadowOffset:{x:-2,y:0},
wordWrap:false,
verticalAlign:'top',
titlePaddingLeft:10,
titlePaddingRight:40,
titlePaddingTop:5,
titlePaddingBottom:15,
title:'This is a test button'
});
win.add(button);
label = Ti.UI.createLabel({
top:10,
width:100,
height:40,
backgroundColor:'gray',
shadowColor:'#ddff0000',
shadowOffset:{x:2,y:2},
wordWrap:false,
verticalAlign:1,
textPaddingLeft:10,
textPaddingRight:40,
textPaddingTop:-15,
textPaddingBottom:15,
text:'This is a test label which needs to be quite long'
});
win.add(label);
label = Ti.UI.createLabel({
top:10,
width:100,
height:80,
backgroundColor:'gray',
shadowColor:'#5500ff00',
shadowOffset:{x:-2,y:0},
wordWrap:false,
verticalAlign:2,
text:'This is a test button'
});
win.add(label);
label = Ti.UI.createLabel({
top:10,
width:100,
height:80,
backgroundColor:'gray',
shadowColor:'#5500ff00',
shadowOffset:{x:-2,y:0},
wordWrap:false,
verticalAlign:0,
text:'This is a test label'
});
win.add(label);
win.open();
pull request https://github.com/appcelerator/titanium_mobile/pull/2645
Thank you for the PR. We're going to revisit this for 3.3.0. It would be helpful if this was not a single PR but multiple smaller requests.
Important properties, are there still on the 3.3.0 roadmap?
Currently, yes.
We have implemented shadowOffset and shadowColor as part of TIMOB-1107. We have decided not to implement wordWrap, verticalAlign and titlePadding as they are non-native behaviors. If people feel that they need these properties, please provide a use case and we would be happy to revisit this decision.
Marking as won't fix. Shadow properties already fixed as a result of TIMOB-1107.
Closing ticket as Won't Fix with reference to the above comments.
Use Case: I need a narrow button with 3 words on it. I used to be able to put a newline (\n) character between the words, and I would get 3 vertically-stacked words, which is what I want. This was back in Ti SDK 5.x on Android (I had to create a label and add it to the button as a child in iOS). Now I'm working in Ti SDK 7.5.2 and the newline is no longer working...I only get the first word in my button. Please allow wordwrap, or at least fix the problem with a button's title when that title contains newline(s).