[TIMOB-18990] Windows: Setting auto for width on labels doesn't work for strings of a certain length
GitHub Issue | n/a |
Type | Bug |
Priority | None |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2015-06-11T14:49:07.000+0000 |
Affected Version/s | Release 4.1.0 |
Fix Version/s | Release 4.1.0 |
Components | Windows |
Labels | qe-4.1.0 |
Reporter | Ewan Harris |
Assignee | Kota Iguchi |
Created | 2015-06-09T19:25:08.000+0000 |
Updated | 2015-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
[~eharris] I don't see any attached screenshots...
[~cwilliams] woops, attached now
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 butI am Window 111
does. I think this is more down to the length of the string rather than what the string containsI've taken a look at what's happening here. It seems we don't calculate the dimensions correctly after passing either
auto
,UI.SIZE
orUI.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.So as far as I see actual
auto
layout behavior should be eitherFILL
orSIZE
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 treatauto
as same as specifyingSIZE
), but there's no implementation for it inLayoutEngine
. I'm planning to add function toViewLayoutDelegate
to inform how components should layout againstauto
.https://github.com/appcelerator/titanium_mobile_windows/pull/276
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