Page 1 of 1

HtmlWindow FindWord ...

Posted: Thu Dec 26, 2013 7:28 pm
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