I need to change the size of a ButtonField. It is inside a VerticalFieldManager which is the only VFM in the MainPage.
I have already changed its width successfully (overriding setPreferredWidth() was enough). However I'm having trouble with changing its height.
Until now, I overrode setPreferredHeight() and it did not do anything. I've tried overriding layout like this (tried all permutations of commented rows):
protected void layout(int arg0, int arg1)
{
//super.layout(myDesiredWidth, myDesiredHeight);
//setExtent(myDesiredWidth, myDesiredHeight);
}
I have also tried overriding sublayout of its manager (the vfm) like this:
protected void sublayout(int arg0, int arg1)
{
super.sublayout(arg0, arg1);
ButtonField myButton = (ButtonField)getField(1);
layoutChild(myButton,myDesiredWidth,myDesiredHeight);
}
It didn't work. I am still not sure how those layout and sublayout methods work in the background but I'm sure that someone needed to alter the size of a button before me.
Edit: I'll be more specific. I was using BB JRE 6.0 and overriding getPreferredHeight() and layout() was buggy (changing height would alter width tremendously, other fields around my button would lose their text etc.). I tried BB JRE 5.0 and increasing the height worked but decreasing didn't work. Whatever, I googled a lot and I couldn't find a clear answer, I guess I have to create my own custom Field and implement paint method from scratch.
