Hi, Sebastian.

The method you wrote below is essentially richinputtext.applyTextAttr. I think if you use applyTextAttr, you won't need to make changes to toggleFormat.

The toggleFormat function is meant as a convenience to support the standard bold, italic, underline buttons, which are usually toggle buttons. All they do is toggle a named attribute (which must be bold, italic, or underline) from true to false or false to true. This saves a step for the UI developer; he does not have to first *get* the format, toggle the value, then *set* the format.

The idea is that the bold button can call toggleFormat("bold"...) when the bold toggle button is pressed; the italic button can call toggleFormat("italic"...) when the italic button is pressed, and the underline button can call toggleFormat("underline"...) when the underline format is pressed. This is a special case of the more general function applyTextAttr.

An example of toggleFormat is in the first window in the example at
http://www.laszlosystems.com/lps-3.1.1/docs/guide/richtext.html
and an example of applyTextAttr is in the third window in that example.

John Sundman (the doc guy) and I have plans to improve the richinputtext doc in the next month or so.

-ben shine


On Dec 30, 2005, at 9:45 AM, Sebastian Wagner wrote:

hi

I tested the new richtinputtext-Component and was confused that i only can change a text to bold OR to underline OR to italic but text can be all bold ,italic and underline at the same time. I found the Function: " richinputtext.prototype.toggleFormat" in richinputtext.lzl and I would recommend to change it so that you can control all aspects of text bold, italic, underline, color, size, bullet, indent ... you can see a complete List of all attributes at Macromedia's Livedocs: http://livedocs.macromedia.com/ flash/8/main/wwhelp/wwhimpl/common/html/wwhelp.htm? context=LiveDocs_Parts&file=00002801.html#wp485180


A made an example with my changed Function:
http://appserver.laszlo-forum.de/lps-3.1/laszlo_forum/myeditor.lzx
I attached the file " myeditor.lzx" to see the source code.
As you can see in source code or below the changes I made in the Function are very simple.

<script>
<![CDATA[
richinputtext.prototype.toggleFormat = function(attrname,attrvalue, beginindex, endindex) { // Due to what seems to be a bug in flash, we create a new, all- undefined // TextFormat object, and *only* set the particular attribute we are
    // toggling. Otherwise, the font may change unpredictably.
    //Debug.write("CHANGE FORMA: "+attrname+" IN "+attrvalue);
var format = this.__LZtextclip.getTextFormat(beginindex, endindex);
    var newFormat = new TextFormat();
    for (val in newFormat){
        //Debug.write(val);
        if (val==attrname){
            //Debug.write("FOUND value!");
            newFormat[val]=attrvalue;
        }
    }

   this.__LZtextclip.setTextFormat(beginindex, endindex, newFormat);

}
]]>
</script>


regards
Sebastian Wagner
--
Sebastian Wagner
http://www.webbase-design.de
http://www.laszlo-forum.de
Bleichstraße 92
75173 Pforzheim
Tel.: 0177-7341829
Home: 07231-417456
[EMAIL PROTECTED]
<myeditor.lzx>
_______________________________________________
Laszlo-dev mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-dev


_______________________________________________
Laszlo-dev mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-dev

Reply via email to