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

Java Development

Reply
Developer
Ebscer
Posts: 855
Registered: ‎08-31-2009
My Device: 9530, 9630, 9800, 8530, 9900, 9810, 9930, PlayBook, Dev Alpha
My Carrier: Verizon
Accepted Solution

Z order in AbsoluteFieldManager

Is there any easy way to adjust the Z-order of fields on an AbsoluteFieldManager? It looks as if removing and readding the fields will work, but it would be nice if there was a simpler way to do this....


Read my thoughts on BlackBerry Development at news.ebscer.com
Please use plain text.
Developer
peter_strange
Posts: 19,601
Registered: ‎07-14-2008
My Device: Not Specified

Re: Z order in AbsoluteFieldManager

Just guessing here, but I suspect the Manager's paint method might control the order of painting, so you might be able to override this in some way and paint the children directly.  But I am just guessing and I have no idea how to do it.  So not much help really.....  Sorry

Please use plain text.
Developer
Ebscer
Posts: 855
Registered: ‎08-31-2009
My Device: 9530, 9630, 9800, 8530, 9900, 9810, 9930, PlayBook, Dev Alpha
My Carrier: Verizon

Re: Z order in AbsoluteFieldManager

Thanks a lot. Even if you were just guessing it pointed me in the right direction.

 

For those interested I have posted my code below. In my case everything that I wanted painted at each "layer" was derived from the same object type so that is what I am checking with the "instanceof" opperator in each loop.

 

class GameScreen extends AbsoluteFieldManager
{
	static int currentLevel;

	GameScreen()
	{
	}

	protected void subpaint(Graphics graphics)
	{
		int count = getFieldCount();
		for(int i=0;i<count;i++)
		{
			if(getField(i) instanceof ObjectTypeA)
			{
				paintChild(graphics,getField(i));
			}
		}
		
		for(int i=0;i<count;i++)
		{
			if(getField(i) instanceof ObjectTypeB)
			{
				paintChild(graphics,getField(i));
			}
		}
		
		for(int i=0;i<count;i++)
		{
			if(getField(i) instanceof ObjectTypeC)
			{
				paintChild(graphics,getField(i));
			}
		}
	}
}

 


Read my thoughts on BlackBerry Development at news.ebscer.com
Please use plain text.