Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Highlighted
Developer
Posts: 30
Registered: ‎11-06-2012
My Device: BB 10 Dev Alpha
My Carrier: MegaFon

Stack layout alignment bug

This is from Beta 3 release notes ("Fixed in this release" section):

 

#4050102

When you were using a QML Container with a LeftToRight stack layout with one element aligned to the left and the second aligned to the right (using the HorizontalAlignment.Right property), both elements used to be aligned side-by-side instead of to each side.

 

However, this still does not work in Gold SDK.

I wanted to reopen this issue but could not find it in Issue Tracker. How can I resubmit this bug? 

Thank you.

Developer
Posts: 526
Registered: ‎05-17-2009
My Device: 9900
My Carrier: ATT

Re: Stack layout alignment bug

are you sure your container is taking up all the width already? Its possible its behaving as expected but that your container doesnt have enough space
Like all of my posts
Developer
Posts: 1,524
Registered: ‎12-18-2012
My Device: Z30, Z10 LE, DevAlpha C, PlayBook

Re: Stack layout alignment bug

[ Edited ]

Haven't tried this in QML but can confirm this doesn't work in C++. Smiley Sad

 

I've set container's background to red color. The container takes all the space but the items are positioned side-by-side on the left.

 

Container *container = Container::create()
		.layout(StackLayout::create().orientation(LayoutOrientation::LeftToRight))
		.add(Label::create()
			 .horizontal(HorizontalAlignment::Left)
			 .text("Label1"))
		.add(Label::create()
			 .horizontal(HorizontalAlignment::Right)
			 .text("Label2"))
		.background(Color::Red);
setContent(container);

Screenshot:

 

 

 


Andrey Fidrya, @zmeyc on twitter
Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Stack layout alignment bug

I wouldn't have thought that the horizontalAlignment property would even be used for a LeftToRight stack layout. That would be when you'd use verticalAlignment.

If you want to have one item left-most and one item right-most, I'd have thought your only option with a StackLayout would be to insert a Container in between, with spaceQuota: 1. Either that, or use a DockLayout, which really seems the more appropriate thing in this situation anyway (doesn't it?).

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Developer
Posts: 30
Registered: ‎11-06-2012
My Device: BB 10 Dev Alpha
My Carrier: MegaFon

Re: Stack layout alignment bug

Thanks Peter. 

I'm using solution with the empty container and space quotas already. (Dock layout allows labels to overlap, which is bad for me.) This solution works well except the fact that margins between left and right control become duplicated because of invisible container between them.

 

Setting half right margin for the left control and half left margin for the right control is inconvenient. Release notes for Beta 2 ("Known issues" section) and release notes for Beta 3 ("Fixed in this release" section) both tell us that horizontal alignment should work within left-to-right stack.

 

So I'm wondering why they documented this issue as fixed in Beta 3. I'd be happy if someone from BlackBerry team came here and clarified the situation.

BlackBerry Development Advisor
Posts: 15,693
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Stack layout alignment bug

Looks like this bug still exists.  I've logged it in Issue Tracker here:

 

HorizontalAlignment::Right does not align controls

 

Thanks for bringing this up.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker