WickStargazer
WickStargazer

Reputation: 409

Codename one Text Area not occupying full width

Seems like this is a bug somewhere in the system, but for the sake of me being wrong, there is some settings i did not put in.

_reviewEnCustom.setFocusable(false);
_reviewEnCustom.getStyle().setPadding(0, 0, 0, 0);
_reviewEnCustom.getStyle().setMargin(0, 0, 0, 0);
_reviewEnCustom.setGrowByContent(true);
_reviewEnCustom.setShouldCalcPreferredSize(true);
_reviewEnCustom.setUIID("CafeDetailsDescription");

This is my text area, however the problem is it does not occupying the width, it stops short at 1/3rd of the page and breaks into a new line. However when the editable is set to true, and try to edit, the width seems to be correct!!

also a track of the issue 303 : Text Area faults

Lastly, the image .....screen shot.!

I have revised the code, by setting the column number, went from 15 to 500, no effect.

TextArea _reviewEnCustom = new TextArea(1,100);
            _reviewEnCustom.setText(reviewen);
            _reviewEnCustom.setEditable(false);
            _reviewEnCustom.setFocusable(false);
            _reviewEnCustom.getUnselectedStyle().setPadding(0, 0, 0, 0);
            _reviewEnCustom.getUnselectedStyle().setMargin(0, 0, 0, 0);

            _reviewEnCustom.setGrowByContent(true);
            _reviewEnCustom.setUIID("CafeDetailsDescription");
            Container _reviewenContainer = new Container(_reviewenLayout);

            _reviewenContainer.addComponent(_constraint,_reviewEnCustom);
            _reviewenContainer.setUIID("CafeDetailsSubContainer");


            _detailsContainer.addComponent(lblTitle);
            _detailsContainer.addComponent(lblLocation);
            _detailsContainer.addComponent(_reviewenContainer);

Still no effect, using column width. I tried to check in the dicussion forum, no help. Got the latest source code down and built it, the textarea width doesnt consume the display width.

Only if i set it to editable, and click edit then the width is consumed. Else it breaks on the 1/3rd of the screen.

Any help? From what i m guessing is the way width is set in TextArea class itself. But i hope i am wrong.

Came to a conslusion about 2 months ago, Was away travelling, That the font will respond perfectly to the underlying library if the sizes are in "Millimeters" and they should be embeded fonts not bitmap fonts.

Never use bitmap fonts in Codenameone! There is a very easy way to embed fonts!

Upvotes: 0

Views: 506

Answers (1)

Shai Almog
Shai Almog

Reputation: 52770

This is completely unrelated to the bugs you pointed at. You just need to define a large enough column count for the text area.

Your usage of getStyle() & setShouldCalcPreferredSize() is also incorrect. The latter shouldn't be invoked by user code and the former should be avoided, you should use explicit styles e.g. getUnselectedStyle().

Upvotes: -1

Related Questions