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

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
Mick P.
Earned some good credits
Earned some good credits
Posts: 145
Joined: Thu Jun 06, 2019 3:41 am
Contact:

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

Post 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.)
User avatar
doublemax
Moderator
Moderator
Posts: 19117
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

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

Post 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.
Use the source, Luke!
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7461
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

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

Post by ONEEYEMAN »

doublemax,
I don't think it will help in either case - this guy will never provide any code sample. ;-)

Thank you.
Mick P.
Earned some good credits
Earned some good credits
Posts: 145
Joined: Thu Jun 06, 2019 3:41 am
Contact:

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

Post 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.
Post Reply