Discussion:
wxHtmlWindow::SetSize not working under wxWidgets-3.0.0
Marco DeFreitas
2014-04-29 19:33:08 UTC
Permalink
I create a wxHtmlWindow and load in a html page. I then try to set the size
of the wxHtmlWindow to the actual rendered size with
wxHtmlWindow::GetInternalRepresentation::GetWidth and
wxHtmlWindow::GetInternalRepresentation::GetHeight. The GetWidth/GetHeight
functions seem to return the correct values, but the SetSize seems to have
no effect. The size originally set in the wxHtmlWindow constructor remains.

This can be duplicated in the html/about sample program. Just change the
original height that the wxHtmlWindow is created in the constructor to 700.
You can then see that the about dialog box gets created with a height of
700 (and not adjusted to the internal rendered size as it should).

This worked under wxWidgets-2.8.12.

This problem seems to appear on both wxGTK and wxMSW.

Thanks,
Marco
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
Vadim Zeitlin
2014-04-29 20:33:03 UTC
Permalink
On Tue, 29 Apr 2014 12:33:08 -0700 (PDT) Marco DeFreitas wrote:

MD> I create a wxHtmlWindow and load in a html page. I then try to set the size
MD> of the wxHtmlWindow to the actual rendered size with
MD> wxHtmlWindow::GetInternalRepresentation::GetWidth and
MD> wxHtmlWindow::GetInternalRepresentation::GetHeight. The GetWidth/GetHeight
MD> functions seem to return the correct values, but the SetSize seems to have
MD> no effect. The size originally set in the wxHtmlWindow constructor remains.

This doesn't have anything to do with wxHtmlWindow actually and is just
due to the change in the way the sizers work: they now consider the initial
size of the window to be its minimal size and not its current size, i.e.
the size set in the ctor or by SetInitialSize() and not the size last set
by SetSize().

IOW you need to use SetInitialSize() here. Or explicitly use
wxSizer::SetItemMinSize(), which might be more clear.

Regards,
VZ
--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/
Marco DeFreitas
2014-04-30 15:06:45 UTC
Permalink
Using SetInitialSize works great, thanks.

You might want to change the html/about sample program to use
SetInitialSize, so people using that as a guide would use the correct
function.

Thanks again!
Marco
Post by Vadim Zeitlin
MD> I create a wxHtmlWindow and load in a html page. I then try to set the size
MD> of the wxHtmlWindow to the actual rendered size with
MD> wxHtmlWindow::GetInternalRepresentation::GetWidth and
MD> wxHtmlWindow::GetInternalRepresentation::GetHeight. The
GetWidth/GetHeight
MD> functions seem to return the correct values, but the SetSize seems to have
MD> no effect. The size originally set in the wxHtmlWindow constructor remains.
This doesn't have anything to do with wxHtmlWindow actually and is just
due to the change in the way the sizers work: they now consider the initial
size of the window to be its minimal size and not its current size, i.e.
the size set in the ctor or by SetInitialSize() and not the size last set
by SetSize().
IOW you need to use SetInitialSize() here. Or explicitly use
wxSizer::SetItemMinSize(), which might be more clear.
Regards,
VZ
--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
Vadim Zeitlin
2014-04-30 15:18:05 UTC
Permalink
On Wed, 30 Apr 2014 08:06:45 -0700 (PDT) Marco DeFreitas wrote:

MD> You might want to change the html/about sample program to use
MD> SetInitialSize, so people using that as a guide would use the correct
MD> function.

I had already done it.

Regards,
VZ
--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/
Loading...