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. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Cascades Development

Reply
Developer
tonygluk
Posts: 30
Registered: ‎11-06-2012
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.

Please use plain text.
Developer
kylefowler
Posts: 479
Registered: ‎05-17-2009
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
Please use plain text.
Developer
Zmey
Posts: 921
Registered: ‎12-18-2012

Re: Stack layout alignment bug

[ Edited ]

Haven't tried this in QML but can confirm this doesn't work in C++. :smileysad:

 

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:

 

 

 

Please use plain text.
Developer
peter9477
Posts: 5,636
Registered: ‎12-08-2010
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 -- (PlayBook 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!
Please use plain text.
Developer
tonygluk
Posts: 30
Registered: ‎11-06-2012
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.

Please use plain text.
Administrator
MSohm
Posts: 12,957
Registered: ‎07-09-2008
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.
Found a bug? Report it using the Issue Tracker
Please use plain text.