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
Developer
Posts: 44
Registered: ‎05-22-2013
My Device: Blackberry 10
My Carrier: 02

Issue with Absolute layout and Container class

[ Edited ]

I have created a custom controll, set Container as it root and tring populate the root container with containers which hold an image. 

 

The issue is just one of this containers get displayed.

 

here is the method populateScene(). it is call in the class constructor

 

void MapView::populateScene()
{
	int i;
	for(int y = 0; y <= 2; y++) {

		for(int x = 0; x <= 2; x++, ++i){

			float xx = (float)x * 256.0;
			float yy = (float)y * 256.0;

			AbsoluteLayoutProperties *layoutProperties =    new AbsoluteLayoutProperties();
			layoutProperties->setPositionX(xx);
			layoutProperties->setPositionY(yy);

			bb::cascades::Container grid;
			grid.setLayoutProperties(layoutProperties);
			grid.add(m_tileImage);
			viewContainer->insert(i, &grid);
		}

	}
}

 

 

Retired
Posts: 749
Registered: ‎12-16-2008
My Device: BlackBerry Z30
My Carrier: Bell

Re: Issue with Absolute layout and Container class

[ Edited ]

You aren't defining i. It needs to be <0 or >0, depending on if you want what you added to be the first or last child.

 

Either way, if you are just trying to build a 3x3 grid of images, you will probably be better off using DockLayout. Otherwise you will need to figure out where to place the images yourself for every device resolution.

 

To place arbitrary numbers of images, combine StackLayouts, using the Quota system.

Paul Bernhardt
Application Development Consultant
BlackBerry
@PBernhardt

Did this answer your question? Please accept this post as the solution.
Found a bug? Report it to the Developer Issue Tracker