monkeytroy
08-30-2007, 06:48 AM
Hey all...
I am implementing some page numbers.. I generate them on the fly with code and want them to display horizontally with the current page being bold.
I add a custom class, that extends text, to a view and then clear out that view when the page numbers need to refresh. The problem is that when I recreate the view container I can't seem to get the new view layout to axis=x. They always go vertical on me. Here is a test.
<canvas width="100%" height="100%" debug="true">
<debug x="10" y="400" width="900" height="300"/>
<class name="myNumberClass" extends="text">
<attribute name="numberId" type="number" value="0"/>
<method event="onclick">
Debug.write(this.numberId);
</method>
<method name="bold">
this.setAttribute("fontstyle", "bold");
</method>
</class>
<view layout="axis:y">
<method event="oninit">
target.targetView.destroy();
var newView = new LzView(target, {name:"targetView", width:500, layout:"axis:x"});
for (i = 0; i < 15; i++) {
var newNumberClass = new myNumberClass(newView, {text: i, numberId: i} );
if (i == 5)
newNumberClass.bold();
}
</method>
</view>
<view name="target" layout="axis:x">
<view name="targetView"/>
</view>
</canvas>
So my question is does anyone know how I can get the newly created view "targetView" to layout on the x axis?
I also tried newView.setAttribute("layout", "axis:x"); after it is created.. same result.
Or... how can I clear out the "targetView" LzView without using the destroy() method on it? That would work too since I could then have it just set to axis:x, clear and repopulate the content.
Thanks for any assistance.
I am implementing some page numbers.. I generate them on the fly with code and want them to display horizontally with the current page being bold.
I add a custom class, that extends text, to a view and then clear out that view when the page numbers need to refresh. The problem is that when I recreate the view container I can't seem to get the new view layout to axis=x. They always go vertical on me. Here is a test.
<canvas width="100%" height="100%" debug="true">
<debug x="10" y="400" width="900" height="300"/>
<class name="myNumberClass" extends="text">
<attribute name="numberId" type="number" value="0"/>
<method event="onclick">
Debug.write(this.numberId);
</method>
<method name="bold">
this.setAttribute("fontstyle", "bold");
</method>
</class>
<view layout="axis:y">
<method event="oninit">
target.targetView.destroy();
var newView = new LzView(target, {name:"targetView", width:500, layout:"axis:x"});
for (i = 0; i < 15; i++) {
var newNumberClass = new myNumberClass(newView, {text: i, numberId: i} );
if (i == 5)
newNumberClass.bold();
}
</method>
</view>
<view name="target" layout="axis:x">
<view name="targetView"/>
</view>
</canvas>
So my question is does anyone know how I can get the newly created view "targetView" to layout on the x axis?
I also tried newView.setAttribute("layout", "axis:x"); after it is created.. same result.
Or... how can I clear out the "targetView" LzView without using the destroy() method on it? That would work too since I could then have it just set to axis:x, clear and repopulate the content.
Thanks for any assistance.