SetVirtualSizeHints (deprecated) and FitInside

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.
Post Reply
Digital Larry
Earned a small fee
Earned a small fee
Posts: 12
Joined: Tue Nov 26, 2019 10:35 pm

SetVirtualSizeHints (deprecated) and FitInside

Post by Digital Larry » Sun Dec 01, 2019 2:36 pm

I'm working with an old open source package using wxWidgets. The first time I got everything set up and compiling I didn't have this problem, but I had to wipe everything out and start over and this time I got a compile error on SetVirtualSIzeHints, e.g.

virtual void SetVirtualSizeHints( int minW, int minH)

which is how it's used in the code.

One error message I got (or was it an article I read) suggested I use FitInside instead, but when I tried that, it told me there was no FitInside(int, int). I reconfigured wxWindows to add --enable-compat28 and I am not getting the error any more, just the deprecation warning. I figure while I am working on the code if there are small things like this I can clean up I might try them, but this one is a dead end, at least in my state of ignorance.

I'm guessing that I need to find the wxWindow whose size I was trying to use, or make a fake one or something.

Here's the original code in my project that calls this:

https://github.com/HolyCityAudio/sooper ... ck_box.cpp

Line 92:

Code: Select all

    int w,h;
    GetTextExtent(_label_str, &w, &h);
    SetVirtualSizeHints (6 + _boxsize + w, max(_boxsize, h));
    SetVirtualSize (6 + _boxsize + w, max(_boxsize, h));
Relevant articles:
https://wx-users.wxwidgets.narkive.com/ ... d-in-2-9-1
https://docs.wxwidgets.org/3.0/classwx_ ... cb0aea5669
https://docs.wxwidgets.org/3.0/classwx_ ... f89ba2e38d

User avatar
doublemax
Moderator
Moderator
Posts: 15074
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: SetVirtualSizeHints (deprecated) and FitInside

Post by doublemax » Sun Dec 01, 2019 2:57 pm

Code: Select all

#if WXWIN_COMPATIBILITY_2_8
    // these are useless and do nothing since wxWidgets 2.9
    wxDEPRECATED( virtual void SetVirtualSizeHints( int minW, int minH,
                                      int maxW = wxDefaultCoord, int maxH = wxDefaultCoord ) );
    wxDEPRECATED( void SetVirtualSizeHints( const wxSize& minSize,
                                            const wxSize& maxSize=wxDefaultSize) );
#endif // WXWIN_COMPATIBILITY_2_8
What happens if you just comment the line out?
Use the source, Luke!

Digital Larry
Earned a small fee
Earned a small fee
Posts: 12
Joined: Tue Nov 26, 2019 10:35 pm

Re: SetVirtualSizeHints (deprecated) and FitInside

Post by Digital Larry » Tue Dec 03, 2019 2:18 pm

Thanks for your response. I'm not ignoring you, but I just wanted to get past this issue so I recompiled wxWidgets with the flag to enable 2.8 compatibility. I now get a deprecation warning but not a compile error. wxWidgets takes about 4 hours to compile on the Raspberry Pi which is one reason I'm just going with what works today. I do greatly appreciate your help though, I'm not sure I would have found the issue without it. :D

DL

Post Reply