Page 1 of 1

wxHTML cells are 0 width/height with wxGTK3/Linux?

Posted: Mon Nov 11, 2019 10:59 pm
by Mick P.
Sorry to ask. My last hours I've been slowly (gdb) stepping through wxHTML code to try to figure out why it doesn't work like wxMSW to generate a page size matching the document's or display any content...

From what I can tell the InitParser uses a system font that has a basic nonzero width and height, but beyond this CreateLayout that is supposed to get the final size of the root cell shows all of the cells having what amounts to 0 width and height. So the final size ends up being the window size, and there is nothing to display.

The document doesn't specify a font anywhere, but that shouldn't be a showstopper. I don't use fonts elsewhere in my application, so it's very possible they wouldn't work in any control. I don't know. The menus and toolbars work, but I don't use any other classical elements because everything else is OpenGL.

(I had some problem with displaying the wxHtmlWindow over wxGLCanvas but I seem to have gotten it to display a white background without text by copy/pasting some code from wxWindowGTK::GTKSendPaintEvents that draws "composite children". I think wxGTK discriminates against so called children when they don't have a transparent background setting, not drawing them, but I don't know how else it would draw them. The HTML element can't be set to have a transparent background--its code forcibly sets its background style and GTK doesn't allow changing background styles.)

Re: wxHTML cells are 0 width/height with wxGTK3/Linux?

Posted: Tue Nov 12, 2019 6:21 am
by doublemax
Please try your html code in a "normal" wxWidgets application first. I'm sure it'll work there.

I don't work under Linux, but i have a faint memory that under GTK the size of a window is only known at a later time than under Windows. Which sounds like it could be the cause for your issue. Try looking in that direction. If that's not it, i don't have any other idea.

Usually i'd ask for a code sample, but as your application is doing things totally differently, that probably wouldn't help anyway.

Re: wxHTML cells are 0 width/height with wxGTK3/Linux?

Posted: Tue Nov 12, 2019 3:18 pm
I don't think it will help in either case - this guy will never provide any code sample. ;-)

Thank you.

Re: wxHTML cells are 0 width/height with wxGTK3/Linux?

Posted: Wed Nov 13, 2019 7:02 am
by Mick P.
Thanks guys. I think I should delete this topic since the problem was the new C++11 vsnprintf specification returns a positive value on buffer overflow instead of the old negative error indicator. wxWidgets initializes the HTML document with a dummy html string that looked like mine as truncated in the debugger. Sorry.

EDITED: I should add the vsnprintf code isn't in wxWidgets, and I think Visual Studio's vsnprintf doesn't conform to C++11's specification, hence why it works as expected in the Win32 version.

EDITED: Oops, meant vsnprintf, wrote snprintf.