[ wxwindows-Bugs-1643619 ] wxRIchTextCtrl - GetStyle() / HasFlag()
incorrect data
SourceForge.net
noreply at sourceforge.net
Wed Jan 24 07:12:05 PST 2007
Bugs item #1643619, was opened at 2007-01-24 15:12
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1643619&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: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: aetmos (aetmos)
Assigned to: Nobody/Anonymous (nobody)
Summary: wxRIchTextCtrl - GetStyle() / HasFlag() incorrect data
Initial Comment:
I've noticed that if I set up a wxRichTextCtrl with a handful of words that are linked with a style that contains a wxTEXT_ATTR_URL flag, and I start searching, say, from the end to the beginning for the first word that is linked, I get all the way to character 0 without getting a single hit. But if I choose a location that I know has a link, it will correctly identify it. It's like HasFlag only returns true correctly the first time its called, and then after that it always returns false, regardless of whether it should be returning true or not.
I've put together a quick example of the problem that I'm experiencing with wxRichTextCtrl. Here are some screenshots:
http://gersic.com/files/wxRichTextCtrl.jpg
http://gersic.com/files/wxRichTextCtrl2.jpg
As you can see, in the second screen shot, characters 15, 16, and 17 should be shown as linked, but they're not.
Here's a link to the exe:
http://gersic.com/files/richTextCtrlBugExe.zip
Here's a link to the complete code:
http://gersic.com/files/richTextCtrlBugCode.zip
And here's the code for what the buttons do:
void richTextWindow::OnButtonClick( wxCommandEvent& event )
{
outputCtrl->Clear();
outputCtrl->AppendText("Counting Backwards from Character 29...\n\n");
int startLocation=29;
wxRichTextAttr attr;
daTextCtrl->GetStyle(startLocation, attr);
if(attr.HasFlag(wxTEXT_ATTR_URL))
{
outputCtrl->AppendText(wxString::Format("Character %d is linked\n",startLocation)); }
else
{
outputCtrl->AppendText(wxString::Format("Character %d is not linked\n",startLocation)); }
while(startLocation>0)
{
startLocation--;
daTextCtrl->GetStyle(startLocation, attr);
if(attr.HasFlag(wxTEXT_ATTR_URL))
{
outputCtrl->AppendText(wxString::Format("Character %d is linked\n",startLocation)); }
else
{
outputCtrl->AppendText(wxString::Format("Character %d is not linked\n",startLocation)); }
}
}
void richTextWindow::OnButton1Click( wxCommandEvent& event )
{
outputCtrl->Clear();
outputCtrl->AppendText("Counting Backwards from Character 18...\n\n");
int startLocation=18;
wxRichTextAttr attr;
daTextCtrl->GetStyle(startLocation, attr);
if(attr.HasFlag(wxTEXT_ATTR_URL))
{
outputCtrl->AppendText(wxString::Format("Character %d is linked\n",startLocation)); }
else
{
outputCtrl->AppendText(wxString::Format("Character %d is not linked\n",startLocation)); }
while(startLocation>0)
{
startLocation--;
daTextCtrl->GetStyle(startLocation, attr);
if(attr.HasFlag(wxTEXT_ATTR_URL))
{
outputCtrl->AppendText(wxString::Format("Character %d is linked\n",startLocation)); }
else
{
outputCtrl->AppendText(wxString::Format("Character %d is not linked\n",startLocation)); }
}
}
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1643619&group_id=9863
More information about the wx-dev
mailing list