If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
I use SetFont to set the font/size of all items in the wxSimpleHtmlListBox but there is no effect and the font/size remains the same. I use the below code with no luck:
Hi,
it will not work. I think you couldn't to do it
AFAIK it could be made by means of wxHtmlWinParser interface, but unfortunately wxSimpleHtmlListBox (wxHtmlListBox) doesn't provide public interface to it (them have m_htmlParser as private member).
OS: Windows XP Pro
Compiler: MSVC++ 7.1
wxWidgets: 2.8.10
Thanks. Using your code for wxHtmlWindow it do works but only in between <font></font> tags. If the text is not inside <font> tag or it's in a <td> tag then the GetParser->SetFonts or GetParser->SetFontSize doesn't have any effect. In addition, the array with the font sizes must have the default values (-2 to +4) because it only understands these values when using <FONT SIZE="x">. But the <FONT> tag works without using the GetParser-> functions too. My wxHtmlWindow will have text appended on short time intervals and it will take a lot memory eventually so I would like to shrink the html source code present in the memory by avoiding <font> tags.
In what wx source files can I find the definitions for the standard fonts/sizes for wxHtmlWindow and wxSimpleHtmlListBox? It seems easier at this point to recompile the source code with the standard values changed.
I'm just trying to have the default font inside wxHtmlWindow and wxSimpleHtmlListBox with the same size and face like when I use wxStaticText or other wx Controls.
In htmllbox.h move this line "wxHtmlWinParser *m_htmlParser;" from private to the public part and rebuild to use the parser in your wxSimpleHtmlListBox. It's not a bad idea to request the designers of this control to make the parser public in the next wxWidgets release.
Last edited by chris_bern on Fri Oct 17, 2008 2:15 am, edited 1 time in total.
Sorry to still bother with this. Whatever function I use from the parser (MySimpleHtmlListBox->m_HtmlParser->..) the application crashes. I guess that it can't be forcefully used as a public member without fixing some other stuff.
I tried too and the Private to Public easy hack doesn't work. Sorry. You can use FONT tag for the list, it shouldn't impact the memory much. You can use wxNORMAL_FONT->GetPointSize() and wxNORMAL_FONT->GetPixelSize() and use it in the FONT tag accordingly.
Yeah I guess I have to use FONT tag for wxSimpleHtmlListBox as there is no <Default Font> solution for that. wxNORMAL_FONT->GetPixelSize() is helpful I only needed to increase it by two points (x&y) to get the same size like the default one. Thanks to tan I found GetParser function very helpful. There's a solution for wxHtmlWindow anyway - can't get all in your life.