Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8734051
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T09:46:05+00:00 2026-06-13T09:46:05+00:00

I have a frame that has some stuff at the top, and a wxScrolledWindow

  • 0

I have a frame that has some stuff at the top, and a wxScrolledWindow below. The scrolled window contains an image selected by the user. I want the frame to shrink-wrap it so that background never shows in the scrolled window. I am using a BoxSizer in the frame. Everything works perfectly until the user drags a border to increase the viewing area. He takes it too far, and background shows. I have tried at least a dozen methods, but I cannot get the window’s border to snap back when the user drags the border beyond where the scrollbars disappear. When the image is loaded, the scrolled window calls SetMaxClientSize() with the right numbers, but it has no effect. A couple of pictures will help. I have just dragged the right border to the right, increasing the viewing area. Here is what it looks like:

enter image description here

I want the border to snap back so it looks like this:

enter image description here

Windows 7 x64, wxWidgets 2.9.4

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T09:46:06+00:00Added an answer on June 13, 2026 at 9:46 am

    Re-implement the size event handler. If the new size is larger than you want, modify it to the largest you accept. Then call the base implementation.

    void MyFrame::OnSize(wxSizeEvent& event)
    {
        wxSize new_size = event.GetSize()
    
        wxSize max_size = ... calculate max size ....
    
        if ( new_size.GetHeight() > max_size.GetHeight() {
            new_size.SetHeight(  max_size.GetHeight() );
        if ( new_size.GetWidth() > max_size.GetWidth() {
            new_size.SetWidth(  max_size.GetWidth() );
    
        event.SetSize( new_size );
        wxFrame::OnSize( event );
    

    Also, be aware of this note in the documentation:

    Important : Sizers ( see Sizers Overview ) rely on size events to
    function correctly. Therefore, in a sizer-based layout, do not forget
    to call Skip on all size events you catch (and don’t catch size events
    at all when you don’t need to).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a data frame in R that has come about from running some
I have a frame.php page if(isset($_COOKIE['user'])){ // do some stuff }else{ // login script
I have a data frame with a numeric column called store that has some
I have an application that does some image processing on each new frame, recently
I have an interface that has two toolbars, one attached to the frame and
I have a data frame that is some 35,000 rows, by 7 columns. it
I have an an fla file, and I'm sure that it has some action
I am using VS c++ 6.0. I have read that 6.0 has some problems
I have a view based application which has some textboxes that I'm trying to
I was just wondering about something. I have a frame that loads pages and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.