Discussion:
wxRichTextCtrl background colours [solved]
(too old to reply)
Gerald Brandt
2009-04-30 03:32:28 UTC
Permalink
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
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
Steve Cookson
2009-04-30 12:25:09 UTC
Permalink
And did it work?

Regards

Steve


_____

From: wx-users-***@lists.wxwidgets.org
[mailto:wx-users-***@lists.wxwidgets.org] On Behalf Of Gerald Brandt
Sent: 30 April 2009 00:32
To: wx-***@lists.wxwidgets.org
Subject: Re: wxRichTextCtrl background colours [solved]


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
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
_______________________________________________ wx-users mailing list
wx-***@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wx-users
Gerald Brandt
2009-04-30 13:20:45 UTC
Permalink
Yes, which is why I added [SOLVED] to the title.
Post by Steve Cookson
And did it work?
Regards
Steve
Sent: 30 April 2009 00:32
Subject: Re: wxRichTextCtrl background colours [solved]
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
Steve Cookson
2009-05-01 00:06:19 UTC
Permalink
Ahh ...


_____

From: wx-users-***@lists.wxwidgets.org
[mailto:wx-users-***@lists.wxwidgets.org] On Behalf Of Gerald Brandt
Sent: 30 April 2009 10:21
To: wx-***@lists.wxwidgets.org
Subject: Re: wxRichTextCtrl background colours [solved]


Yes, which is why I added [SOLVED] to the title.
Post by Steve Cookson
And did it work?
Regards
Steve
_____
Post by Steve Cookson
Sent: 30 April 2009 00:32
Subject: Re: wxRichTextCtrl background colours [solved]
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.
Post by Steve Cookson
This is what I do to get the default background colour, and my modified
one: ( mEditor is the richtextctrl)
Post by Steve Cookson
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)
Post by Steve Cookson
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.
Post by Steve Cookson
Gerald
_______________________________________________ wx-users mailing list
wx-***@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wx-users
Post by Steve Cookson
_______________________________________________ wx-users mailing list
wx-***@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wx-users

Loading...