[wx-dev] wxRichTextCtrl newline linking bug
Tom Gersic
wxdev at teleologic.net
Thu Jan 25 14:47:39 PST 2007
Julian
Ah, I found _a_ way to fix it, but i don't know if it's a particularly
good way to do it...In the OnMoveMouse function in richtextctrl.cpp
(line 436), there's a bit of code that checks to see if "we need to
change the cursor". If the mouse is positioned after the last character
in a line, the position being returned here is the position of the last
character in the line. I imagine the proper way to fix this would be to
make sure that it doesn't return the last character in the line unless
the mouse is actually over that character, but I'm not sure how to do
that. One way to fix it, though, is to check whether the character after
the position being returned is a newline. If it is, don't change the
cursor. That solves the onMouseMove, but onLeftUp, etc. need similar
adjustments.
Tom
if (hit != wxRICHTEXT_HITTEST_NONE)
{
wxTextAttrEx attr;
if (GetStyle(position, attr))
{
if (attr.HasFlag(wxTEXT_ATTR_URL))
{
wxString daContent = GetValue().Mid(position+1,1);
if(daContent.CmpNoCase("\n") != 0)
{
SetCursor(m_urlCursor);
}
else
{
SetCursor(m_textCursor);
}
}
else if (!attr.HasFlag(wxTEXT_ATTR_URL))
{
SetCursor(m_textCursor);
}
}
}
More information about the wx-dev
mailing list