LPP-4029

This is example 29.14 in Chapter 29. Methods, Events, Handlers, and Attributes of the dguide:

<canvas height="20">
  <view>
    <attribute name="width" type="number" value="20"/>
    <attribute name="height" type="number" value="20"/>
    <attribute name="bgcolor" type="color" value="red"/>
  </view>
</canvas>

which causes the compiler to output these warnings:

methods-events-attributes-$14.lzx:3:55: In element 'view' attribute 'width' with type 'number' is overriding parent class attribute with same name but different type: sizeExpression methods-events-attributes-$14.lzx:4:56: In element 'view' attribute 'height' with type 'number' is overriding parent class attribute with same name but different type: sizeExpression

The reference says that width and height are of type sizeExpression, but there's no mention of sizeExpression in the dguide.

I can stop the error in two ways:

change the type from number to sizeExpression:

<canvas height="20">
  <view>
    <attribute name="width" type="sizeExpression" value="20"/>
    <attribute name="height" type="sizeExpression" value="20"/>
    <attribute name="bgcolor" type="color" value="red"/>
  </view>
</canvas>

remove the type attribute, which I don't think detracts from this example:

<canvas height="20">
  <view>
    <attribute name="width" value="20"/>
    <attribute name="height" value="20"/>
    <attribute name="bgcolor" type="color" value="red"/>
  </view>
</canvas>

Is one better than the other?

Thanks,

Lou

Reply via email to