There is an article in the latest version of RB Developer which
demonstrates storing styled text in XML documents -- and restoring
from it. I found it quite a good introduction to XML in RB. For
shortish chunks of text, it works quite speedily to go between a
styled text editfield and an XML document.
On 8/8/06, Tobias Meyer-Janson
<[EMAIL PROTECTED]> wrote:
>I'm now trying to add styles after parsing xml,
AFAIK to style EditField contents you have to use the selection
properties/methods. In my experience the style disapperars after
changing the text. So I would do the styling at last.
You could store the style as XMLNode attribute and use an array or
dictionary or combination to store start and length of each text part
that was added to the field.
>case "ART_NR"
>node=node.Child(0)
store the EditField1.Text.Len as Cursorposition
store node.Value.Len as length for this part
store the style you want [node.GetAttribute("style")] to apply to this part
>EditField1.AppendText(endofline + node.Value + chr(9))
>case "ART_TITEL"
store the EditField1.Text.Len as Cursorposition
store node.Value.Len as length for this part
store the style you want to apply to this part
>node=node.Child(0)
>EditField1.AppendText(node.Value + EndOfLine + EndOfLine)
for each stored trippel
EditField1.SelStart=stored_Cursor_position 'perhaps there is an
ofset of one how it is counted
EditField1.SelLength=stored_PartLength
select case stored_style
case "bold"
EditField1.SelBold=true
...
end
next
This is no 100% RB-code but I hope you understand what I mean.
If node should be able to contain different styles for different
words, you have to parse the contents of node as XML nodes with style
tags until you get TextNodes as smalest parts that will get styles
always for the whole part.
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>