09-06-2011 04:03 AM
hi to all ,
I am making a screen which look like this
Now the problm i am facing is when i add another to field my view becomes clumsy somthing like image below lower portion of last to field not viewed completly
I need it to look clean as like the above pic above pic..And I can show only 2 to Number field in this area. other to field can be seen via scroll view.
One thing i want to mention is if I click on the last field its view becomes neat and clean like the above img
em talking about the to number fields only I have issue only regarding their view.Each To number field consist of an HFM have a label and a BasicEdit Field
I hope I m clear about my porblem
Regards
Solved! Go to Solution.
09-06-2011 08:35 AM
Hi BB Developer.
Try setting the margin on the bottom.
That issue might arise when another field is clashing with the previous field.
So try settin marging to the second HorizontalField manager.
Let me know if it resolves.
Regard
Krishnan.
09-06-2011 09:48 AM
Do you have a custom manager laying out your fields? Or a regular VFM and custom fields? How do you position them on the screen?
I suspect you have some wrong calculations for the vertical positions of the fields beyond the first. Something like adding the margin between the fields only once instead of on each loop cycle.
09-07-2011 01:44 AM
Sorry for such late reponse my net was not responding
@krishnamurari yes i m setting margins of my hfm each time i add it to vfm
@arkadyz No i am using HFM as my custom manager (customized its only to give it width and height of my choice)
VFM is a regular mangr nothing done with it, I dont set the position just add them .Also em adding margins only once not in a loop cycle.
One thing i did not get is if a click on second field all drwing get ok Why is that ??
Regards
09-07-2011 02:05 AM
Hi BB Developer,
If its not much to ask can you post your code so anybody who comes accross it can suggest whats the mistake.
Even we could have a look and tell what the error.
Regards
Krishnan,
09-07-2011 07:39 AM
This is the code to create the hfm field
public VOPHorizontalFieldManager getToNumberField(String number) {
// label field
LabelField label = new LabelField ("To:" , FIELD_LEFT){
protected void paint(Graphics graphics) {
graphics.setColor(Color.WHITE);
super.paint(graphics);
}
};
label.setMargin(8,6,4,8);
//Container manager
VOPHorizontalFieldManager hfm = new VOPHorizontalFieldManager(Display.getWidth(), 37){
protected void paintBackground(Graphics g) {
super.paintBackground(g);
g.clear();
g.drawBitmap(0, 0, Display.getWidth(),37, background, 0, 0);
}
};
//number input field
BasicEditField field = new BasicEditField("", number, 30, BasicEditField.FILTER_DEFAULT)
{
protected void paint(Graphics graphics) {
graphics.setColor(Color.BLACK);
super.paint(graphics);
}
protected void paintBackground(Graphics g) {
g.setColor(text_Field_Border_Color);
g.drawRoundRect(4, 0, Display.getWidth()-48, this.getHeight() , 6,6);
g.setColor(Color.WHITE);
g.fillRoundRect(4, 0,Display.getWidth()- 48, this.getHeight() , 6,6);
g.setColor(Color.BLACK);
super.paintBackground(g);
}
};
field.setPadding(4,6,4,6);
field.setMargin(4,4,4,6);
hfm.add(label);
hfm.add(field);
return hfm;
}
I just add a new hfm to a basic VFM when i clik a menuiten add.VFM is than added to the screen
my vfm is usual vfm only on thing is had override its sublayout method to make a length restriction
VerticalFieldManager vfm = new VerticalFieldManager(
protect void sublayout(int maxWidth , int maxHeigh){
super(maxWidth , 80 );
setExten(maxWidth , 80);
}
});
i hope now you can understand better
09-07-2011 07:53 AM
Hi BB Developer,
Thanks for posting the code on my request.
I am exactly not so sure but do try this.
Set margin on bottom as 10 or fifteen. Cause i feel the horizontal field manager is taking only the place of the basic edit field so it might be paint it on top of the other.
This is just a suggestion.
Let me know if it works.
Regards
Krishnan.
09-07-2011 10:11 AM
Can you post the sublayout code of VOPHorizontalFieldManager? There's so much that can go wrong there, even just trying to limit the size of the manager...
You can drop super.paintBackground in your paintBackground code - it will be painted over anyway.
09-08-2011 12:36 PM
Hi
I had posted the method in my pervious post ,
here is my whole class
class VOPHorizontalFieldManager extend HorizontalFieldManager{
VOPHorizontalFieldManager(int w , int h){
this.width = w;
this.height = h ;
}
protect void paint(){
setExtent(width, heigth);
}
protected void paintBackground(Graphics g) {
super.paintBackground(g);
g.clear();
g.drawBitmap(0, 0, width,height, background, 0, 0);
}
}Regards
09-12-2011 04:30 AM
Have you really got this coded?
protect void paint(){
setExtent(width, heigth);
}
Or is this your sublayout method renamed.