07-14-2009 06:41 AM
Hello, forum
I have a custom VerticalFieldManager with this sublayout method:
protected void sublayout( int maxWidth, int maxHeight ) { int iNumFields = getFieldCount(); int iYPos = 7; for (int i = 0; i < iNumFields; i++) { Field fField = this.getField(i); setPositionChild(fField, 10, iYPos); layoutChild(fField, maxWidth-10, maxHeight); iYPos = iYPos + fField.getHeight(); } setExtent(Display.getWidth(), getPreferredHeight());}
And of course if I put another Manager based instance into it using 'add' method I get nothing, because there is no manager layout processing here. How to do that?
Thanks
Solved! Go to Solution.
07-14-2009 06:43 AM
07-14-2009 06:48 AM
Thanks for you quick reply, Simon.
But what if I have usual VerticalFieldManager testvfm = new VerticalFieldManager();
I just put these into it:
testvfm.add(new LabelField("test"));testvfm.add(new LabelField("tset"));
And that works when I add it into the screen but not if I add it into that manager I've described above.
How can I set height to this testvfm so my 'sublayout' method will know that it is not zero height.
07-14-2009 06:51 AM
Also, here is the getPreferredHeight method:
public int getPreferredHeight() { int iNumFields = getFieldCount(); int h = 14; for (int i = 0; i < iNumFields; i++) { Field fField = this.getField(i); h += fField.getHeight(); } return h; }
And for usual fields like LabelField or TextField this custom class works fine.
07-16-2009 07:07 AM