[ wxwindows-Bugs-1714813 ] ApplyXXXToSelection remove style

SourceForge.net noreply at sourceforge.net
Tue Feb 26 06:55:44 PST 2008


Bugs item #1714813, was opened at 2007-05-08 09:27
Message generated for change (Comment added) made by juliansmart
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1714813&group_id=9863

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: RichTextCtrl
Group: None
>Status: Closed
>Resolution: Fixed
Priority: 5
Private: No
Submitted By: Richard Öhlinger (theroe)
Assigned to: Julian Smart (juliansmart)
Summary: ApplyXXXToSelection remove style

Initial Comment:
I think the ApplyXXXToSelection (e.g. ApplyBoldToSelection, or ApplyItalicToSelection) methods misbehave if nothing has been selected.

proof: in the richttextsample: 
 - remove all content
 - press bold button
 - write "hello"
 - press italic button
 - write "world"

expected result: "hello" is bold and "world" is bold and actual result: "hello" is bold and "world" is italic only

i had a quick look at the sourcecode an i think replacing the ELSE-part in all those functions with:


	if (m_richTextCtrl->HasSelection())
		m_richTextCtrl->SetStyleEx(m_richTextCtrl->GetSelectionRange(), attr, wxRICHTEXT_SETSTYLE_WITH_UNDO|wxRICHTEXT_SETSTYLE_OPTIMIZE|wxRICHTEXT_SETSTYLE_CHARACTERS_ONLY);
	else {
		wxRichTextAttr current = m_richTextCtrl->GetDefaultStyleEx();
		current.Apply(attr);
		m_richTextCtrl->SetAndShowDefaultStyle(current);
	}


----------------------------------------------------------------------

>Comment By: Julian Smart (juliansmart)
Date: 2008-02-26 14:55

Message:
Logged In: YES 
user_id=59495
Originator: NO

Good point, thanks! Now applied.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1714813&group_id=9863




More information about the wx-dev mailing list