shadow
shadow

Reputation: 43

Handling c++ wxWidgets EVT_MAXIMIZE macro

I have a (maybe) simple question. I'd like to resize my program window after the user clicked on "maximize" since I want to fit the data to the window, without leaving "grey patches" (hope it does make sense lol, since I'm from Italy I'm not sure it does) . The problem is if I try to show a simple message, it doesn't show up. This is the piece of code I think you need to look at of my class (cpp file)

void EBCFrame::OnMaximize(wxMaximizeEvent& event)
{
//    _window->Fit();
    wxMessageBox(_T("maximize test"));
}

// Event table for EBCFrame
BEGIN_EVENT_TABLE(EBCFrame, wxFrame)
    ...
    EVT_MAXIMIZE(EBCFrame::OnMaximize)
END_EVENT_TABLE()

And here's the header file

class EBCFrame : public wxFrame
{
    public:
        // Constructor
        EBCFrame(const wxString& title);
        // Event handlers
        .....
        void OnMaximize(wxMaximizeEvent& event);

    private:
        // This class handles events
        DECLARE_EVENT_TABLE()

        wxScrolledWindow* _window;
        ....
};

I apologize if it's not enough and you need the full code; in that case, I'll provide as soon as I read this question again. Thank you for your support!

Upvotes: 0

Views: 425

Answers (1)

Anonymous Coward
Anonymous Coward

Reputation: 6226

Judging from your earlier question's code: wxWidgets: can't inherit from wxListCtrl;

You seem to be using a wxScrolledWindow for a wxListCtrl which is not needed (the wxListCtrl already manages the scrolling of its content) If that is the case, remove the wxScolledWindow from your code.

If that wxListCtrl (EBCList) is the only client window in your frame (EBCFrame), wxWidgets will size it automatically.

If you have added more widgets to your frame in the meantime, you may want to look into the sizer classes to compose your layout (e.g wxBoxSizer).

Upvotes: 2

Related Questions