03-03-2010 11:30 AM - edited 03-03-2010 11:31 AM
Hello,
know I have another question! ![]()
I want to change the size from a HFM or VFM! I try it with sublayout() and with setExtent(). But I think the only value I set is the maximum width or height, but I want to set the permanent size of the manager. Know the manager is so wide like the field which is in it. Anybody understand me and can help me?
regards Maja
03-03-2010 11:49 AM
Did you call setExtent before or after the call to super.sublayout?
03-04-2010 03:14 AM
Know I call setExtent() only!
public CustomVerticalFieldManager(long style, int width, int height){
super(style);
super.setExtent(width, height);
}
protected void paint(Graphics graphics)
{
graphics.setBackgroundColor();
graphics.setColor();
graphics.clear();
super.subpaint(graphics);
}
03-04-2010 08:54 AM - edited 03-04-2010 08:55 AM
So ok maybe I can explain it a little bit more!
I want that it looks like:
--------------------------------------------------
| | |
| | Field1 |
| Field | |
| | Field2 |
| | |
--------------------------------------------------
Know it looks like
--------------------------------------------------
| | |
| |Field1|
|Field| |
| |Field2|
| | |
--------------------------------------------------
anybody an idea?
03-04-2010 01:09 PM
Here's a quick-and-dirty Manager that uses half the width of the screen. You could put two of these in a HorizontalFieldManager and your layout would look like your picture.
NB: this is not necessarily good Manager design, it's just an example that works.
public class HalfWidthManager extends VerticalFieldManager {
private int halfScreenWidth = Display.getWidth() / 2;
protected void sublayout(int width, int height) {
super.sublayout(getPreferredWidth(), height);
setExtent(getPreferredWidth(), getPreferredHeight());
}
public int getPreferredWidth() {
return halfScreenWidth;
}
}
10-30-2012 03:02 AM
Can we set width and height of HFM and VFM object without subclassing them ?
Are there any methods that sets the width and height directly on objects of HFM and VFM .
HorizontalFieldManager mTitleFieldManager = new HorizontalFieldManager(); mTitleFieldManager.anyMethodToSetWidthOrHeight();
Any help ?
10-30-2012 05:20 AM
"Can we set width and height of HFM and VFM object without subclassing them ?"
There are cases where you can set height to width, using style bits like USE_ALL_WDITH. But these specific layout managers have been designed to take all the width (for HorizontalFieldManager, and height (for VerticalFieldManager) that they need. Given this design criteria, the RIM developers did not feel it necessary to offer the methods you are suggesting.
However there is nothing stopping you writing your own manager that does this, or extending HFM or VFM to attempt to do this. I suggest you try to write your own Manager, the effort of doing this will make you appreciate what is going on in the supplied Managers better too I think.
"Are there any methods that sets the width and height directly on objects of HFM and VFM"
Pretty much the same comments apply to this question too.
Does this help or have I misunderstood the question?
11-02-2012 07:56 AM
Hi peter
You got everything absolutely correct. Thanks for your reply.
It means we cannot provide hardcoded values (like field.setwidth(100Units) or field.setHeight(100Units)) to the width and height properties of a particular field or manager.
Yes will do the necessary subclassing.