wxMAXIMIZE style is not working!

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.
tomay3000
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 207
Joined: Mon Apr 24, 2017 4:23 am

wxMAXIMIZE style is not working!

Post by tomay3000 »

Hello,
the wxMAXIMIZE style is not working for apps launched outside the IDE (Code::Blocks, ...).

is this a bug ?

Thank you for your understanding.
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxMAXIMIZE style is not working!

Post by doublemax »

Please show the generated code.
Use the source, Luke!
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxMAXIMIZE style is not working!

Post by ONEEYEMAN »

Hi,
What OS?
Are trying to run from the Terminal/Command Prompt or from the Explorer/Finder/whatever Linux uses?

Thank you.
tomay3000
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 207
Joined: Mon Apr 24, 2017 4:23 am

Re: wxMAXIMIZE style is not working!

Post by tomay3000 »

Actually it is a wxMSW related issue (sorry for not mentioning that).

Code: Select all

MyFrame1( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("test"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 800,600 ), long style = wxDEFAULT_FRAME_STYLE|wxMAXIMIZE|wxTAB_TRAVERSAL );
When I run it inside Code::Blocks IDE it shows full screen, but when I run it directly from the windows explorer (double-clicking it) it wouldn't.

I have found that adding this code:

Code: Select all

m_maximizeOnShow = true;
in my frame constructor will fix the issue, but this is just a workaround, and the main problem persists.

For some reason under windows, WS_MAXIMIZE style is getting ignored even added to the main window list of styles.

I thing this is a bug, tell me if I am wrong.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxMAXIMIZE style is not working!

Post by ONEEYEMAN »

Hi,
I think you needed a second pair of eyes. ;-)
In your constructor call you supply 2 contradicting statements - you set the size of the window and at the same time you want it to be maximized.
You should have either one of those.

Thank you.
tomay3000
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 207
Joined: Mon Apr 24, 2017 4:23 am

Re: wxMAXIMIZE style is not working!

Post by tomay3000 »

No, I don't. I am already wearing glasses :wink:
and BTW, that piece of code has been generated using wxFormBuilder (not me). And I have also tried with wxSize(-1, -1) and wxDefaultSize before posting here.

Thank you.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxMAXIMIZE style is not working!

Post by ONEEYEMAN »

Hi,
How do you call the constructor?

Thank you.
tomay3000
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 207
Joined: Mon Apr 24, 2017 4:23 am

Re: wxMAXIMIZE style is not working!

Post by tomay3000 »

Code: Select all

testFrame::testFrame(wxWindow *parent) : MyFrame1(parent)
{
#if wxUSE_STATUSBAR
    m_statusBar1->SetStatusText(_("Hello Code::Blocks user!"), 0);
    m_statusBar1->SetStatusText(wxbuildinfo(short_f), 1);
#endif

    const void* jpegData = NULL;
    size_t jpegSize = 0;

    wxLoadUserResource(&jpegData, &jpegSize, "image1", RT_RCDATA, wxGetInstance());
    wxMemoryInputStream is(jpegData, jpegSize);
    m_panel1->LoadFile(is, wxBITMAP_TYPE_JPEG);

    if (!m_mediaCtrl1->ShowPlayerControls(wxMEDIACTRLPLAYERCONTROLS_DEFAULT))
        // error - warn user
        wxMessageBox("Could not show player controls");

    m_listCtrl1->AppendColumn(_(""), wxLIST_FORMAT_CENTER, 20);
    m_listCtrl1->AppendColumn(_("File"), wxLIST_FORMAT_LEFT, /*wxLIST_AUTOSIZE_USEHEADER*/305);
    m_listCtrl1->AppendColumn(_("Length"), wxLIST_FORMAT_CENTER, 75);

    AddToPlayList("test");

    bSizer2->ShowItems(false);

    m_maximizeOnShow = true; // <------------- THIS FIXED THE PROBLEM
    //Center();
    //Maximize();
}
----------------

Code: Select all

testFrame* frame = new testFrame(NULL);
frame->SetIcon(wxICON(aaaa)); // To Set App Icon
frame->Show();
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxMAXIMIZE style is not working!

Post by ONEEYEMAN »

Hi,
Which wx version?
Also, I presume, it is Win10?
And final question - did you include proper "manifest"?

Thank you.
tomay3000
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 207
Joined: Mon Apr 24, 2017 4:23 am

Re: wxMAXIMIZE style is not working!

Post by tomay3000 »

wx v3.1.1
Windows 7 Pro with SP1 32-Bit
Manifest included:

Code: Select all

#include "wx/msw/wx.rc"
[/b]

if you search for WS_MAXIMIZE ignored in google you will see that lots of people complaining about this problem for Win API.
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxMAXIMIZE style is not working!

Post by doublemax »

Please take the "minimal" sample, add the wxMAXIMIZE flag to MyFrame and run it. I'm pretty sure it will work correctly.

Code: Select all

m_maximizeOnShow = true; // <------------- THIS FIXED THE PROBLEM
This is nothing from wxWidgets itself. So i assume something in the wxFormBuilder code is responsible.
Use the source, Luke!
tomay3000
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 207
Joined: Mon Apr 24, 2017 4:23 am

Re: wxMAXIMIZE style is not working!

Post by tomay3000 »

it did not worked either for the minimal sample :(
look:
Untitled2.png
Untitled2.png (40.71 KiB) Viewed 2846 times
Untitled.png
Untitled.png (52.15 KiB) Viewed 2846 times
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxMAXIMIZE style is not working!

Post by ONEEYEMAN »

Hi,
You can also call "frame->Maximize()" to make sure that the frame is maximized, before calling the "frame->Show()" to avoid flickering.

Thank you.
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxMAXIMIZE style is not working!

Post by doublemax »

Code: Select all

m_maximizeOnShow = true; // <------------- THIS FIXED THE PROBLEM
Correction. After checking the source code, this is actually part of wxWidgets. Setting it still directly doesn't sound like a good idea though.

Unfortunately i have no explanation why wxMAXIMIZE doesn't work for you.
Use the source, Luke!
tomay3000
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 207
Joined: Mon Apr 24, 2017 4:23 am

Re: wxMAXIMIZE style is not working!

Post by tomay3000 »

This is why I thought, it could be a wxMSW port bug.
Should I report an issue in github ?
Post Reply