I was using the SetStyle method to do some changes on my RichTextCtrl
and it gives immediate visual feedback of the changes. However, I
changed to SetStyleEx to use some of the flags and now the changes are
only visible after I do some editing on the buffer.
Is there anyway to force an update or to make SetStyleEx to behave
like SetStyle does?
I was using the SetStyle method to do some changes on my RichTextCtrl
and it gives immediate visual feedback of the changes. However, I
changed to SetStyleEx to use some of the flags and now the changes are
only visible after I do some editing on the buffer.
Is there anyway to force an update or to make SetStyleEx to behave
like SetStyle does?
Any advice on this would be great!
It looks to me like both of them end up calling the same function in the buffer object, so I don't see what would cause this difference. Have you tried calling Refresh?
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
Well, I just gave a try at Refresh. While it updates the style of my
text, the caret position and size are still wrong after applying the
new style and it only corrects after editing (just like my whole style
did when I didn't called update).
I've decided to look at the C++ code to try understand what is going
on and it seems that in fact SetStyleEx and SetStyle ends up resulting
in very different function calls. While wxRichTextCtrl::SetStyleEx
calls the wxRichTextBuffer::SetStyle, the wxRichTextCtrl::SetStyle
calls the parent class method of same name wxTextCtrlBase::SetStyle.
There is some mystic macro magic going on that I don't quite
understand, but it seems that it ends up calling wxTextCtrl::SetStyle.
In the end it looks like those 2 aparently equivalent calls, are
making quite different thing on the underlying C++ code. I didn't have
the time to look further on that and try to understand what those 2
C++ methods are doing and why the wxTextCtrl::SetStyle updates the
buffer the way I want and the other doesn't, but I'll investigate
further.
Many thanks to the feedback, Robin, it gave a nice starting point
where to look for a solution
I'll post back if I find anything else about this.
···
On Wed, Nov 5, 2008 at 10:02 PM, Robin Dunn <robin@alldunn.com> wrote:
It looks to me like both of them end up calling the same function in the
buffer object, so I don't see what would cause this difference. Have you
tried calling Refresh?
I solved the problem by calling the RichTextCtrl LayoutContent method.
I found it by accident trying to find the caret moving methods. I was
planning to use those as a hack to solve my problem, but I happened to
bump into the right solution
One thing I managed to learn is that the wxPython API is HUGE!
Sometimes it's hard to find the right thing, but it probably exists
somewhere.
It looks to me like both of them end up calling the same function in the
buffer object, so I don't see what would cause this difference. Have you
tried calling Refresh?
Hi Robin,
Well, I just gave a try at Refresh. While it updates the style of my
text, the caret position and size are still wrong after applying the
new style and it only corrects after editing (just like my whole style
did when I didn't called update).
I've decided to look at the C++ code to try understand what is going
on and it seems that in fact SetStyleEx and SetStyle ends up resulting
in very different function calls. While wxRichTextCtrl::SetStyleEx
calls the wxRichTextBuffer::SetStyle, the wxRichTextCtrl::SetStyle
calls the parent class method of same name wxTextCtrlBase::SetStyle.
There is some mystic macro magic going on that I don't quite
understand, but it seems that it ends up calling wxTextCtrl::SetStyle.
In the end it looks like those 2 aparently equivalent calls, are
making quite different thing on the underlying C++ code. I didn't have
the time to look further on that and try to understand what those 2
C++ methods are doing and why the wxTextCtrl::SetStyle updates the
buffer the way I want and the other doesn't, but I'll investigate
further.
Sorry, I guess I was looking in the wrong place.
Many thanks to the feedback, Robin, it gave a nice starting point
where to look for a solution
I'll post back if I find anything else about this.
Thanks.
···
On Wed, Nov 5, 2008 at 10:02 PM, Robin Dunn <robin@alldunn.com> wrote:
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!