Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-10252] TiAPI: Button/label: Add wordWrap, textPadding, titlePadding

GitHub Issuen/a
TypeNew Feature
PriorityMedium
StatusClosed
ResolutionWon't Fix
Resolution Date2014-04-28T20:59:47.000+0000
Affected Version/sRelease 3.0.0
Fix Version/sn/a
ComponentsTiAPI
Labelsapi
ReporterMartin Guillon
AssigneeVishal Duggal
Created2012-07-26T04:49:59.000+0000
Updated2019-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();

Comments

  1. Martin Guillon 2012-07-26

    pull request https://github.com/appcelerator/titanium_mobile/pull/2645
  2. Ingo Muschenetz 2013-10-08

    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.
  3. Hans Knöchel 2014-01-24

    Important properties, are there still on the 3.3.0 roadmap?
  4. Ingo Muschenetz 2014-01-24

    Currently, yes.
  5. Ingo Muschenetz 2014-04-28

    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.
  6. Ingo Muschenetz 2014-04-28

    Marking as won't fix. Shadow properties already fixed as a result of TIMOB-1107.
  7. Lee Morris 2017-03-23

    Closing ticket as Won't Fix with reference to the above comments.
  8. Shawn Lipscomb 2019-07-26

    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).

JSON Source