I've just started looking into replacing the word processing engine in my
software, based on the StyledTextCtrl, with the RichTextCtrl component. I
need the ability to display images with the text, among other things, and
this seemed like the right direction to go.
But right out of the gate, I'm seeing something that doesn't make any sense
to me. The issue is one of overlapping styles. Please see the attached
brief sample.
In line 1 of the sample output, I issue, BeginBold() and then BeginItalic(),
I get text in Bold and Italics. It's what I'd expect. If I then
EndItalic(), I'm back to just bold, and if I then EndBold(), I'm back to
plain, undecorated text. So far, so good.
But in line 2 of the output, I change the order a bit, it doesn't work
right. I BeginBold() and BeginItalic() as before, but then call EndBold()
rather than EndItalic(). I'd expect Italics only, but I get Bold only.
When I then EndItalic(), the Bold goes away and I'm back to plain text.
Lines 3 - 5 are just variations on this theme, using different formatting in
different orders.
At least with Bold, Italics, and Underline, which is all I've messed with so
far, the EndXXX() functions seem to end formatting in the opposite order it
was applied, regardless of which EndXXX() function you call.
I've run the attached program on both OS X and Windows with Python 2.5.x and
wxPython 2.8.9.2 and the results are the same.
Do I really need to disable all formatting, then re-enable the formatting I
want to keep at every format change? That hardly seems practical. Any
guidance would be much appreciated.
David
RTFTest.py (3.23 KB)