02-11-2011 07:40 AM - edited 02-11-2011 07:41 AM
Hi Guys,
How could you set the width of the DropDown window (which displays all choice items of your choice field)? The application automatically sets the width based on the width of the choice items.
Thank you
Nitin
Solved! Go to Solution.
02-11-2011 08:14 AM
no way to modify it. if you need it different create your own objectchoicefield, for example leveraging objectlistfield and popupscreen.
02-11-2011 09:34 AM
Thank for your confirmation, you saved my time.
But that is a bad news. It must be too much work to create own objectchoicefield.
Nitin
02-11-2011 10:03 AM
Never had the need to use this, so haven't tried it, but I note the ObjectChoiceField includes a method called:
getWidthOfChoice();
Now I presume that the Width is in pixels, and that the normal process would invoke using the field.font and doing a getAdvance(). But I've often wondered if by changing this I would change the actual width of the Field.
Possibly worth a try. If you do try it, let us know.
02-11-2011 10:13 AM
Hey Peter,
getWidthOfChoice() works!
Because it is getting width of only one choice item, I thought it is not for field width and I completely ignored it and spent hours for work around.
And just to mention, buy using this, it does not affect the actual width of the Field.
Thanks
Nitin
02-11-2011 12:31 PM
Oops! here is correction
getWidthOfChoice() works fine with Version 4.6 but it is not working on Device software Version 5.0
What a nightmare.....
Nitin
10-25-2011 03:30 AM
10-25-2011 04:37 AM
May be a better way:
override layout(int width, int height):
protected void layout(int width, int height) {
setMinimalWidth(width - 61); // 61 is the min value, lower than 61 will not work
super.layout(width, height);
}