Gerald Brandt
2009-04-30 03:32:28 UTC
I changed my style definitions to this:
mDefaultStyle = mEditor->GetDefaultStyle() ;
mSelectStyle = mDefaultStyle ;
wxColor color(128, 128, 255) ;
mSelectStyle.SetBackgroundColour(color) ;
color = mEditor->GetBackgroundColour() ;
mDefaultStyle.SetBackgroundColour(color) ;
Gerald
mDefaultStyle = mEditor->GetDefaultStyle() ;
mSelectStyle = mDefaultStyle ;
wxColor color(128, 128, 255) ;
mSelectStyle.SetBackgroundColour(color) ;
color = mEditor->GetBackgroundColour() ;
mDefaultStyle.SetBackgroundColour(color) ;
Gerald
Hi,
I'm changing the background colour in a range of text, which works just fine. At some point, I want to get rid of the background colour, basically changing it to the way it was.
This is what I do to get the default background colour, and my modified one: ( mEditor is the richtextctrl)
mDefaultStyle = mEditor->GetDefaultStyle() ;
mSelectStyle = mDefaultStyle ;
wxColor color(128, 128, 255) ;
mSelectStyle.SetBackgroundColour(color) ;
Then I do this to change the background colour: (which works)
wxRichTextRange range(mStartBlock, mEndBlock) ;
mEditor->SetStyleEx(range, mSelectStyle) ;
Then I do this to put the background back to default: (which DOESN'T work)
wxRichTextRange range(mStartBlock, mEndBlock) ;
mEditor->SetStyleEx(range, mDefaultStyle) ;
That's basically it. Any idea why it doesn't work. The codes not complicated, but I've got to be missing something.
Gerald
I'm changing the background colour in a range of text, which works just fine. At some point, I want to get rid of the background colour, basically changing it to the way it was.
This is what I do to get the default background colour, and my modified one: ( mEditor is the richtextctrl)
mDefaultStyle = mEditor->GetDefaultStyle() ;
mSelectStyle = mDefaultStyle ;
wxColor color(128, 128, 255) ;
mSelectStyle.SetBackgroundColour(color) ;
Then I do this to change the background colour: (which works)
wxRichTextRange range(mStartBlock, mEndBlock) ;
mEditor->SetStyleEx(range, mSelectStyle) ;
Then I do this to put the background back to default: (which DOESN'T work)
wxRichTextRange range(mStartBlock, mEndBlock) ;
mEditor->SetStyleEx(range, mDefaultStyle) ;
That's basically it. Any idea why it doesn't work. The codes not complicated, but I've got to be missing something.
Gerald