Wednesday, October 20, 2010

[Bada] Variable height row in custom list

Use EnrichedText class to display multi-line text in a row, and call GetTotalLineHeight() to get the height of the row. (view more)

EnrichedText titleText;
titleText.Construct(Dimension(200, 150));
titleText.SetHorizontalAlignment(TEXT_ALIGNMENT_LEFT);
titleText.SetTextWrapStyle(TEXT_WRAP_WORD_WRAP); // Wrap the text
titleText.SetTextAbbreviationEnabled(false); // no abbreviation

TextElement titleTextElement;
titleTextElement.Construct(text1);
Font f;
f.Construct(FONT_STYLE_PLAIN, 24);
titleTextElement.SetFont(f);
titleText.Add(titleTextElement);

AppLog("HEIGHT %i", titleText.GetTotalLineHeight());