Last night, I was trying to extend the Text class, but I couldn't find any way to get the text and font in the Text base-class.
Here is a simplified example of what I was trying to do: [FONT=courier new]class UnderlineText extends WatchUi.Text
{[/FONT]
[INDENT=2][FONT=courier new]function draw(dc)
{
// fields text and font should be inherited from class Text
// and accessible as protected instance attributes
var dims = dc.getTextDimensions( text, font );
// Draw an Underline below the text.
dc.drawLine( locX, locY + dims[1], locX + dims[0], locY + dims[1]);
// locX and locY are available from the base-class.
// text and font (and maybe justification) should be as well.
}[/FONT][/INDENT]
[FONT=courier new]}[/FONT]
Basically, without access to the text and font attributes, its difficult to measure the text.
Eventually, my class ended up keeping a separate text and font variable, and trying hard to keep them synchronized with the base-class in all cases.
But I shouldn't need to jump through that in a language that has inheritance.
Its already clear that the Drawable-attributes locX, locY, width and height are inherited and accessible.
(although they seem to be "public", and I think text & font only need to be "protected")