That exactly what I wanted to avoid. The whole idea of subviews (or: custom drawables) is their local coordinate system, so you can place them anywhere without changing code.
I found that I could use the <drawable id="mySubviewId" class="MyModule.MyClassName"> tag, but then there's no way to add x, y, width and height, as the DTD doesn't allow that. So how am I supposed to place these drawables in the view?
<layout id="Layout">
<label id="datetLabel" x="center" y="11" font="Gfx.FONT_SMALL" justification="Gfx.TEXT_JUSTIFY_CENTER" />
<drawable class="Clock">
<param name="locX">118</param>
<param name="locY">114</param>
<param name="color">Gfx.COLOR_WHITE</param>
</drawable>
</layout>
class Clock extends Ui.Drawable {
var Color;
function initialize(dictionary) {
dictionary.put(:identifier, "Clock");
Drawable.initialize(dictionary);
Color = dictionary[:Color;
}
function draw(dc) {
dc.setColor(Color, Color);
dc.drawText(locX, locY, Gfx.FONT_SMALL, "12:00", Gfx.TEXT_JUSTIFY_CENTER);
}
}