Hello
I have the problem that for one of my windows, the result by a query could reach even 6000 lines, and building this with wxhtmlwindow takes ages. Each entry is consisting of a reference name in the beginning, and a text with different length and with line breaks and different colours. The click reference for the whole entry the reference is called when clicked.
The whole html page is in one string.
To see how it should look like, here a screenshot.
Is it somehow possible to make it scrollable, that only 10 have to be generated at once? however, is it then possible to scroll down the references, and see them during scrolling, like it is possible when the whole page is loaded into it?
Or what other possibilities are there to make it quicker?
wxhtmlwindow alternative Topic is solved
-
- Super wx Problem Solver
- Posts: 466
- Joined: Tue Jun 20, 2006 6:47 pm
- Contact:
Re: wxhtmlwindow alternative
You can try wxHtmlListBox or wxSimpleHtmlListBox.
Re: wxhtmlwindow alternative
Thank you wxhtmllistbox works fine, just a new problem arose.
If I change the selectionbackground with
it also changes the colours of the foreground text. If it uses the standard colour for the selection background it does not change it, so what is going wrong?
If I change the selectionbackground with
Code: Select all
SetSelectionBackground("LIGHT BLUE");
-
- Super wx Problem Solver
- Posts: 466
- Joined: Tue Jun 20, 2006 6:47 pm
- Contact:
Re: wxhtmlwindow alternative
I'm not really familiar with that control, but it looks like your supposed to override the method
to return the color to be used when the item is selected. I think the way it works is your return the selected color you want for the given unselected color. For example, to convert text that is red when unselected to white, green when unselected to blue and all other colors to black, you would have the body of the method look like:
Code: Select all
virtual wxColour GetSelectedTextColour(const wxColour &colFg) const
Code: Select all
if(colFg==*wxRED)
return *wxWHITE;
else if(colFg==*wxGREEN)
return *wxBLUE;
else
return *wxBLACK;
Re: wxhtmlwindow alternative
As my selection is multicolor this alone would not help.
But as said, if I leave the standard selection colour, it stays in the right colours only if I change the selectionbackgroundcolour it changes the colour of the text.
Or would it mean, write one for all the colours?
But as said, if I leave the standard selection colour, it stays in the right colours only if I change the selectionbackgroundcolour it changes the colour of the text.
Or would it mean, write one for all the colours?
-
- Super wx Problem Solver
- Posts: 466
- Joined: Tue Jun 20, 2006 6:47 pm
- Contact:
Re: wxhtmlwindow alternative
This still works with multiple colors. Here's a really simple example where the box just keeps the colors the same in the selection.
Or if your 100% sure you don't need to change any of colors when selected, you could just do
Code: Select all
class MyListBox:public wxHtmlListBox
{
public:
MyListBox(wxWindow*);
protected:
virtual wxString OnGetItem (size_t n) const;
virtual wxColour GetSelectedTextColour(const wxColour &colFg) const;
};
MyListBox::MyListBox(wxWindow* p):wxHtmlListBox(p)
{
SetSelectionBackground("LIGHT BLUE");
}
wxColour MyListBox::GetSelectedTextColour(const wxColour &colFg) const
{
if( colFg==wxColor(0x80,0x80,0x80) )
{
return wxColor(0x80,0x80,0x80);
}
else if( colFg==wxColor(0x80,0,0x80) )
{
return wxColor(0x80,0,0x80);
}
else if( colFg==wxColor(0,0x80,0x80) )
{
return wxColor(0,0x80,0x80);
}
else
{
return *wxBLACK;
}
}
wxString MyListBox::OnGetItem (size_t n) const
{
wxString s = "<font color=\"#808080\"><b>Item </b></font>";
s << wxString::Format("%d ",static_cast<int>(n));
s << "<font color=\"#800080\">More Text </font>";
s << "<font color=\"#008080\">Other Text</font>";
return s;
}
Or if your 100% sure you don't need to change any of colors when selected, you could just do
Code: Select all
wxColour MyListBox::GetSelectedTextColour(const wxColour &colFg) const
{
return colFg;
}
Re: wxhtmlwindow alternative
yes, the last one should work.
Re: wxhtmlwindow alternative
thanks