08-08-2012 06:54 AM - edited 08-08-2012 07:00 AM
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.
08-08-2012 06:59 AM
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.
08-09-2012 09:33 AM - edited 08-09-2012 09:52 AM
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.
08-09-2012 10:01 AM
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:
Have you tried what I suggested here:
Why are you adding the HFM?
08-10-2012 01:58 AM
08-10-2012 02:46 AM
08-13-2012 01:23 AM
08-13-2012 04:26 AM
Have you tried the following as I suggested previously here:
"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."
08-14-2012 07:57 AM
Following code i have used to mainscreen with nothing else:
String s="Center";
LabelField lbl = new LabelField(s,LabelField.USE_ALL_WIDTH|LabelField.F
{
protected void paint(Graphics graphics)
{
graphics.setBackgroundColor(Color.LIGHTGRAY);
graphics.clear();
super.paint(graphics);
}
};
HorizontalFieldManager hfm = new HorizontalFieldManager(HorizontalFieldManager.FIEL
hfm.add(lbl);
add(hfm);
I got infinite horizontal scroll and label is not even in center. ![]()
08-14-2012 08:24 AM
But that is not what I suggested you do! ![]()
Please try what I suggested.