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
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: HorizontalFieldManager Problem

[ Edited ]

I have done the same and the code works fine.  So I think you are looking for a problem in your code.

 

Just add the LabelField to a MainScreen with nothing else and see what happens.  If that fails for you please paste the complete code for the MainScreen and LabelField here. 

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: HorizontalFieldManager Problem

And just to emphasize Simon's point, "not working" is not a useful description of a problem.

 

If you take your car into a mechanic and you tell him it is "not working", what is the mechanic going to ask you?  Is the radio not working?  Or does the car not start?  Or what?

 

Same is true here.  We don't know if not working means not displaying, crashing when displaying, not displaying the color you want or ....

 

I think I have said this to you before, but the clearer and more accurate and more complete the problem description, the more chance you have of someone looking at it. 

Developer
Posts: 255
Registered: ‎05-03-2012
My Device: 9930
My Carrier: Vodafone

Re: HorizontalFieldManager Problem

[ Edited ]

I have added label to manager and manager to screen. problem is that : i am using USE_ALL_WIDTH and horizontal scroll. So when i scroll horizontally ,screen get scrolls even if controls are not there on screen. I can scroll infinitely on screen. This is my problem. Thats whats happening even if i change the code as per ur advice.

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: HorizontalFieldManager Problem

And how are we supposed to figure that out from "Its not working"!

 

And the sample code you gave us yesterday did not use a HFM, it used a VFM - see:

http://supportforums.blackberry.com/t5/Java-Development/HorizontalFieldManager-Problem/m-p/1851279#M...

 

Have you tried what I suggested here:

http://supportforums.blackberry.com/t5/Java-Development/HorizontalFieldManager-Problem/m-p/1851329#M...

 

Why are you adding the HFM?

Developer
Posts: 255
Registered: ‎05-03-2012
My Device: 9930
My Carrier: Vodafone

Re: HorizontalFieldManager Problem

I have tried the same code directly on screen.Still it gives infinite horizontal scroll.
Developer
Posts: 16,998
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: HorizontalFieldManager Problem

yes, because that is what it is supposed to do.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
Posts: 255
Registered: ‎05-03-2012
My Device: 9930
My Carrier: Vodafone

Re: HorizontalFieldManager Problem

Then what should be changed in this code?
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: HorizontalFieldManager Problem

Have you tried the following as I suggested previously here:

http://supportforums.blackberry.com/t5/Java-Development/HorizontalFieldManager-Problem/m-p/1851329#M...

 

"Just add the LabelField to a MainScreen with nothing else and see what happens.  If that fails for you please paste the complete code for the MainScreen and LabelField here."

Developer
Posts: 255
Registered: ‎05-03-2012
My Device: 9930
My Carrier: Vodafone

Re: HorizontalFieldManager Problem

Following code i have used to mainscreen with nothing else:
String s="Center";


LabelField lbl = new LabelField(s,LabelField.USE_ALL_WIDTH|LabelField.FIELD_HCENTER)
{
protected void paint(Graphics graphics)
{
graphics.setBackgroundColor(Color.LIGHTGRAY);
graphics.clear();
super.paint(graphics);
}
};
HorizontalFieldManager hfm = new HorizontalFieldManager(HorizontalFieldManager.FIELD_HCENTER|HorizontalFieldManager.HORIZONTAL_SCROLL);
hfm.add(lbl);
add(hfm);

 

I got infinite horizontal scroll and label is not even in center. Smiley Sad

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: HorizontalFieldManager Problem

But that is not what I suggested you do! Smiley Surprised

 

Please try what I suggested.