The way the debugger does this is to use a single <text> object and use
internal HTML to change the colors of the text. The problem with that is that
there is no platform-independent way -- swf and DHTML use different markup.
swf uses <font> and DHTML uses <span>. In the debugger this difference is
handled in the platform-dependent console window code.
On 2010-07-15, at 06:25, cem sonmez wrote:
> Hi all,
> With the test case below, I am able to format the text. But another
> goal is to change the text fgcolor same with the laszlo debugger's
> (info: "blue", warn:"yellow"..)
> I am trying to do this like that. But I donT see the text as yellow.
> Am I missing something, or is there another useful solution about this
> issue?
> Thanks in advance
>
> <canvas>
> <debug name="myDebugger" width="400" height="250"/>
> <class name="debuggerWindow">
> <window name="notificationWindow" title="Notification Window"
> width="250" height="400" resizable="true" clip="true">
> <vscrollbar />
> <text name="messageArea" multiline="true"
> selectable="true" clickable="true"
> width="${parent.width-30}"/>
> </window>
> <text name="message" fgcolor="#FFFF00">
> <attribute name="info" type="color" value="yellow"/>
> <attribute name="error" type="color" value="red"/>
> <attribute name="warn" type="color" value="blue"/>
> </text>
> <method name="addMessage" args="type, msg">
> /*switch (type) {
> case message.info :
> }*/
> message.setAttribute('text',msg);
> //message.setAttribute('fgcolor',"yellow");
> notificationWindow.messageArea.addText(message.text);
> </method>
> </class>
> <simplelayout spacing="10" />
> <debuggerWindow name="notificationWindow"/>
> <edittext name="messageEdittext" width="300" />
> <button text="Send message">
> <text name="message" visible="false"/>
> <handler name="onclick">
> var isim = "cem";
> var formatMessage = parent.messageEdittext.text;
> message.setAttribute('text', formatMessage);
> message.format("%w : %w \n", formatMessage, isim);
> parent.notificationWindow.addMessage("info",
> message.text);
> parent.messageEdittext.clearText();
> </handler>
> </button>
> </canvas>
>
> --
> Cem SONMEZ