PDA

View Full Version : cannot set text of windowtext tag...


whisperstorm
09-24-2003, 06:33 PM
I'm sure I'm going to smack my head when I hear what I'm doing wrong, but for some reason I simply cannot get the text of this element to change via js...

<canvas debug="true">
<simplelayout axis="y"/>
<windowtext name= "consolewindow" id="consolewindow" height="200" width="400" text="hello there"/>
<button onclick="changeText('hello');">
Move <b>me</b>
<method name="changeText" args="theText">
Debug.write(consolewindow.text);
Debug.write("trying to set text:" + theText);
consolewindow.setAttribute('text',theText);
</method>
</button>
</canvas>

I've tried several variations, where the text is a child of the windowtext and other things, and I can see in the debugger that that value of consolewindow.text has changed, but the view of the consolewindow still has the old text.

antun
09-24-2003, 09:06 PM
Actually you're not doing anything wrong here, this is because of the state of the components in LPS v1. The current version is 1.0.1, and all the Redmond components were rewritten in clean, up-to-date LZX for that release.

So if you download 1.0.1 (http://www.laszlosystems.com/developers/download/), the following should work:


<canvas debug="true">
<simplelayout axis="y"/>
<windowtext name= "consolewindow"
id="consolewindow"
height="200" width="400"
text="hello there"/>

<button onclick="changeText('smelly');">Move me
<method name="changeText" args="theText">
Debug.write(consolewindow.getText());
Debug.write("trying to set text:" + theText);
consolewindow.setAttribute('text',theText);
</method>
</button>
</canvas>


One of the major problems with v1 was the legacy Redmond components. They didn't make use of the new constraints, which allow a variable to be tied to a text field and so forth. If you're feeling adventurous, you can always take a peek at the source code for the redmond components that ship with 1.0.1 to get ideas.

-Antun

whisperstorm
09-24-2003, 10:00 PM
This works like a charm here at home. Looks like I need to update my server at work. Thanks!

whisperstorm
09-26-2003, 11:10 AM
wierd thing now is I get a warning about having something like this:

<text><b>some text here</b></text>

Compilation Warnings

main.lzx:10:10: element "b" from namespace "http://www.laszlosystems.com/2003/05/lzx" not allowed in this context

antun
09-29-2003, 08:34 AM
Are you sure that's what's causing the bug? I just tried:


<canvas>
<text><b>some text here</b></text>
</canvas>


... and it worked fine (I got bold text). The error you posted pointed to line 10. Is there anything else in your app that might be causing it?

-Antun

whisperstorm
09-29-2003, 08:46 AM
I'll try to creat a reproducable test case and post it here.