Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getPreferredHeight and getPreferredWidth return incorrect values #3

Open
hannsl opened this issue Dec 10, 2011 · 2 comments
Open

getPreferredHeight and getPreferredWidth return incorrect values #3

hannsl opened this issue Dec 10, 2011 · 2 comments

Comments

@hannsl
Copy link

hannsl commented Dec 10, 2011

When the styles USE_ALL_HEIGHT and/or USE_ALL_WIDTH are set, getPreferredHeight and/or getPreferredWidth return Integer.MAX_VALUE. I believe this to be incorrect since the meaning of USE_ALL_HEIGHT and USE_ALL_WIDTH is that the field should use all the height/width given to it by its manager. Furthermore, the use of the styles should be taken into account by the ManagerDelegate.sublayout and FieldDelegate.layout methods.

@hannsl
Copy link
Author

hannsl commented Dec 11, 2011

It appears that this behavior may have been introduced to workaround a bug in the buttonfield class. However, I believe a better workaround for this would be to override the buttonfield getPreferredWidth as follows:
public int getPreferredWidth() {
if (isStyle(USE_ALL_WIDTH)) { // workaround for buttonfield bug
return Integer.MAX_VALUE;
} else {
return FieldDelegate.getPreferredWidth(this);
}
}

@infamous1982
Copy link
Member

My first thought here is that fields not added to a manager still have to return a preferred width/height which is Integer.MAX_VALUE in the case of USE_ALL_WIDTH / USE_ALL_HEIGHT in the default BlackBerry API. Still, i'll doublecheck this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants