Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-18990] Windows: Setting auto for width on labels doesn't work for strings of a certain length

GitHub Issuen/a
TypeBug
PriorityNone
StatusClosed
ResolutionFixed
Resolution Date2015-06-11T14:49:07.000+0000
Affected Version/sRelease 4.1.0
Fix Version/sRelease 4.1.0
ComponentsWindows
Labelsqe-4.1.0
ReporterEwan Harris
AssigneeKota Iguchi
Created2015-06-09T19:25:08.000+0000
Updated2015-07-01T18:53:24.000+0000

Description

Description

When setting the width of a label to *auto*, it appears that the width is not being set properly when the string for the label text contains both letters and numbers, see the attached screenshots for references. *Ti.UI.FILL and Ti.UI.SIZE work with no problems* Although auto has been replaced by Ti.UI.FILL and Ti.UI.SIZE the default app still uses it.

Steps To Reproduce

1. Add the attached app.js to an existing project and build using appc run -p windows -T wp-emulator 2. Switch between tab 1 and tab two 3. Tap the label on tab 1

Actual Result

2. The text for the label on tab 1 is not shown correctly, I am Window is displayed rather than I am Window 1 3. The alert displays the actual text for the label

Expected Result

The label on tab 1 should display the whole string *I am Window 1*

Attachments

FileDateSize
app.js2015-06-10T18:08:47.000+00001179
autoWidthNumber.PNG2015-06-10T18:00:53.000+000034732
autoWidthWord.PNG2015-06-10T18:00:53.000+000045802

Comments

  1. Christopher Williams 2015-06-10

    [~eharris] I don't see any attached screenshots...
  2. Ewan Harris 2015-06-10

    [~cwilliams] woops, attached now
  3. Ewan Harris 2015-06-10

    Doing some more investigation into this and it appears to be that certain strings do show, for example I am Window 1111 doesn't show but I am Window 111 does. I think this is more down to the length of the string rather than what the string contains
  4. Gary Mathews 2015-06-10

    I've taken a look at what's happening here. It seems we don't calculate the dimensions correctly after passing either auto, UI.SIZE or UI.FILL. https://github.com/appcelerator/titanium_mobile_windows/blob/master/Source/LayoutEngine/src/ParseProperty.cpp#L32 This will always return zero in this case. We don't calculate anything based on the screen resolution of the device.
  5. Kota Iguchi 2015-06-11

    So as far as I see actual auto layout behavior should be either FILL or SIZE depending on components described in [Transitioning to the New UI Layout System](http://docs.appcelerator.com/platform/latest/#!/guide/Transitioning_to_the_New_UI_Layout_System) (For example, Label should treat auto as same as specifying SIZE), but there's no implementation for it in LayoutEngine. I'm planning to add function to ViewLayoutDelegate to inform how components should layout against auto.
  6. Kota Iguchi 2015-06-11

    https://github.com/appcelerator/titanium_mobile_windows/pull/276
  7. Lokesh Choudhary 2015-07-01

    Verified the fix. Setting width to auto now works fine. Closing. Environment: Appc Studio: 4.1.0.201506261427 Ti SDK: 4.1.0.v20150701091830 Ti CLI: 4.0.1 Alloy: 1.6.2 Windows: 8.1 Enterprise 64-bit APPC NPM: 4.1.0-1 APPC CLI: 4.1.0-4 Windows emulator : 8.1

JSON Source