RichTextCtrl.ApplyUnderlineToSelection() problem on Windows

Hi all,

I'm having a problem with text formatting in the RichTextCtrl on Windows only. I see the same thing in wxPython 2.8.12.1 and 2.9.4.0. I've tried Windows 7 and Windows XP, as well as OS X and Ubuntu. It fails on Windows, not OS X or Linux.

The RichTextCtrl has handy formatting methods for ApplyBoldToSelection(), ApplyItalicToSelection() and ApplyUnderlineToSelelction(). But on Windows, ApplyUnderlineToSelection() doesn't always show up immediately. If you underline a selection, the underlining for that original selection won't show up until a subsequent Underline or Bold call is made elsewhere. Removing underlining always occurs immediately. Bold and Italics appear to work immediately. Underlining appears to work if called immediately AFTER Bold. But sometimes it doesn't happen immediately.

Update(), Refresh(), and UpdateWindowUI() have no effect.

I've attached a simple sample.

1. Can others replicate this?

2. Is there a workaround anyone can find?

3. Is this an issue with my code, wxPython, or wxWidgets?

Thanks in advance,
David

RTF Format Problem.py (3.87 KB)

Hi all,

I'm having a problem with text formatting in the RichTextCtrl on Windows
only. I see the same thing in wxPython 2.8.12.1 and 2.9.4.0. I've
tried Windows 7 and Windows XP, as well as OS X and Ubuntu. It fails on
Windows, not OS X or Linux.

The RichTextCtrl has handy formatting methods for
ApplyBoldToSelection(), ApplyItalicToSelection() and
ApplyUnderlineToSelelction(). But on Windows,
ApplyUnderlineToSelection() doesn't always show up immediately. If you
underline a selection, the underlining for that original selection won't
show up until a subsequent Underline or Bold call is made elsewhere.
Removing underlining always occurs immediately. Bold and Italics appear
to work immediately. Underlining appears to work if called immediately
AFTER Bold. But sometimes it doesn't happen immediately.

Update(), Refresh(), and UpdateWindowUI() have no effect.

I've attached a simple sample.

1. Can others replicate this?

Yes.

2. Is there a workaround anyone can find?

3. Is this an issue with my code, wxPython, or wxWidgets?

Looks like a wxWidgets bug to me. Please create a ticket about it at trac.wxwidgets.org.

···

On 10/4/12 2:28 PM, David Woods wrote:

--
Robin Dunn
Software Craftsman

Thanks. I've submitted ticket #14735.

One other note. If the line with Underlining ALSO contains Bold or Italics formatting, then Underline works fine. This problem seems to occur only when underline is the only formatting applied to a line.

David

···

On 10/08/2012 11:55 AM, Robin Dunn wrote:

On 10/4/12 2:28 PM, David Woods wrote:

Hi all,

I'm having a problem with text formatting in the RichTextCtrl on Windows
only. I see the same thing in wxPython 2.8.12.1 and 2.9.4.0. I've
tried Windows 7 and Windows XP, as well as OS X and Ubuntu. It fails on
Windows, not OS X or Linux.

The RichTextCtrl has handy formatting methods for
ApplyBoldToSelection(), ApplyItalicToSelection() and
ApplyUnderlineToSelelction(). But on Windows,
ApplyUnderlineToSelection() doesn't always show up immediately. If you
underline a selection, the underlining for that original selection won't
show up until a subsequent Underline or Bold call is made elsewhere.
Removing underlining always occurs immediately. Bold and Italics appear
to work immediately. Underlining appears to work if called immediately
AFTER Bold. But sometimes it doesn't happen immediately.

Update(), Refresh(), and UpdateWindowUI() have no effect.

I've attached a simple sample.

1. Can others replicate this?

Yes.

2. Is there a workaround anyone can find?

3. Is this an issue with my code, wxPython, or wxWidgets?

Looks like a wxWidgets bug to me. Please create a ticket about it at trac.wxwidgets.org.