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
Trusted Contributor
ABoul
Posts: 138
Registered: ‎07-11-2010
My Device: Bold 9700
My Carrier: O2
Accepted Solution

difficulty understanding layout managers

i have a layout manager with all its children laid out according to its sublayout(int, int) procedure. one of the children's positions is a variable x that i want to change at runtime. i created another procedure inside my custom LayoutManager class called setX(int), where i change the value of this variable. however, it doesn't move on the actual screen. how do i solve this?

 

thanks in advance

Please use plain text.
Developer
TobiasReaper
Posts: 85
Registered: ‎05-03-2010
My Device: Not Specified

Re: difficulty understanding layout managers

Have you called your custom layout Manager's invalidate method after you are done changing the position of the field? 

According to the api the invalidate method marks the entire manager as requiring repainting.

Please use plain text.
Trusted Contributor
ABoul
Posts: 138
Registered: ‎07-11-2010
My Device: Bold 9700
My Carrier: O2

Re: difficulty understanding layout managers

yes i have.

 

 

	public void setX(int X)
	{
		x += X;
		this.invalidate();
	}

 

 

and in the sublayout...

 

setPositionChild(SelectorField, 25 + x*25, 298);

 

where SelectorField is the field to be moved.

 

Please use plain text.
Developer
TobiasReaper
Posts: 85
Registered: ‎05-03-2010
My Device: Not Specified

Re: difficulty understanding layout managers

ah i see. I would suggest that you post the whole code (excluding your business logic of course) so that the developers here can look at your code and suggest solutions.

Please use plain text.
Trusted Contributor
ABoul
Posts: 138
Registered: ‎07-11-2010
My Device: Bold 9700
My Carrier: O2

Re: difficulty understanding layout managers

[ Edited ]

ahh nevermind. it was a small error in which a local and a global variable had the same name :\. thanks for trying to help anyway.

Please use plain text.
Developer
TobiasReaper
Posts: 85
Registered: ‎05-03-2010
My Device: Not Specified

Re: difficulty understanding layout managers

My pleasure :smileyhappy:

Good luck coding!

Please use plain text.