HtmlWindow FindWord ...

Are you writing your own components and need help with how to set them up or have questions about the components you are deriving from ? Ask them here.
Post Reply
valiyuneski
Earned a small fee
Earned a small fee
Posts: 14
Joined: Thu Dec 11, 2008 3:01 pm

HtmlWindow FindWord ...

Post by valiyuneski »

Hi All,

I am trying to write an JSON editor which one one side of the splitter displays the JSON file parsed in tree, and on the other side of the splitter the JSON file in an HtmlWindow. As the mouse over the HTMLWindow moves the cells are identified and the tree scrolls to the correct item. However i would like to have this both ways meaning each slotItemChanged in tree i need to jump to the correct string in HtmlWindow. I googled it quite some time now, but with no result.

Oh i have already tried :
void MainFrame::locateInHTML(const wxString &strFind)
{
// Find Text in HTML
if(wxHtmlContainerCell* pContainer = m_htmlWin->GetInternalRepresentation())
{
// one way
/*if(const wxHtmlCell *pCell = pContainer->Find(wxHTML_COND_ISANCHOR, &strFind))
{
wxHtmlSelection selection;
wxString curr = pCell->ConvertToText(&selection);
if(curr.IsSameAs(strFind))
{
// Select given word
m_htmlWin->Refresh();
m_htmlWin->SelectWord(pCell->GetAbsPos());
}
}*/

wxHtmlCell* pCell = pContainer->GetFirstChild();
while(pCell)
{
wxHtmlSelection selection;
wxString curr = pCell->ConvertToText(&selection);
if(curr.IsSameAs(strFind))
{
// Select given word
m_htmlWin->Refresh();
m_htmlWin->SelectWord(pCell->GetAbsPos());

// Found !!!
break;
}
else
pCell = pContainer->GetNext();
}
}
}


Any help would be highly appreciated

Kind regards,

Valentin
Post Reply