avoid minimize window double click title bar

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.

avoid minimize window double click title bar

Postby ui-dev » Tue May 28, 2013 12:55 pm

Hi everyone !

I'm quite new here, it's my first post :wink:

My english isn't perfect so i'll be quick : there's a behavior of my window, I wish to avoid , I have noticed that when one makes a double click on the title bar, the window is resized ( not iconized ), and I'd like to avoid this , I really don't see which is the best way to do this, if there's a clean way. I want my window to stay "maximized", or iconized, but not resizeable .

Thanks in advance !

Peter
ui-dev
In need of some credit
In need of some credit
 
Posts: 3
Joined: Tue May 28, 2013 12:30 pm

Re: avoid minimize window double click title bar

Postby doublemax » Tue May 28, 2013 2:05 pm

Which platform?

Under Windows, doubleclicking the title bar does the same as clicking the "maximize" icon. You can avoid this by not passing the wxMAXIMIZE_BOX style flag when creating the frame.

The wxMAXIMIZE_BOX style flag is included in wxDEFAULT_FRAME_STYLE, so you could use
wxDEFAULT_FRAME_STYLE & ~wxMAXIMIZE_BOX instead.
Use the source, Luke!
User avatar
doublemax
Part Of The Furniture
Part Of The Furniture
 
Posts: 7151
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: avoid minimize window double click title bar

Postby ui-dev » Tue May 28, 2013 3:28 pm

doublemax wrote:Which platform?


MS Windows XP Professional SP3

doublemax wrote:The wxMAXIMIZE_BOX style flag is included in wxDEFAULT_FRAME_STYLE, so you could usewxDEFAULT_FRAME_STYLE & ~wxMAXIMIZE_BOX instead


Code: Select all
// Here is the flags I use
wxCAPTION | wxMINIMIZE_BOX | wxCLOSE_BOX | wxSYSTEM_MENU


Code: Select all
// Here is the code I use at the application start
bool MyApp::OnInit( void )
{
    if( wxApp::OnInit() )
    {
        MainWindow * main_window = new MainWindow( _T("MyApp") ) ;

        main_window->Maximize() ;

        main_window->Show() ;

        return true ;
    }
   
    // ---- else ----

    return false ;
}


Thank you for your help, anyway !
ui-dev
In need of some credit
In need of some credit
 
Posts: 3
Joined: Tue May 28, 2013 12:30 pm

Re: avoid minimize window double click title bar

Postby doublemax » Tue May 28, 2013 9:17 pm

This seems to be the "normal" behavior under Windows.

The only idea i have would be to disable the double click on the title bar at a low Windows level.

Override wxFrame::MSWWindowProc and put this code there:
Code: Select all
WXLRESULT MyFrame::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
{
  if(nMsg==WM_NCLBUTTONDBLCLK) {
    return 0;
  }

  return wxFrame::MSWWindowProc(nMsg, wParam, lParam);
}

I didn't test that very much, so it could have some unwanted side effects. Use at your own risk ;)
Use the source, Luke!
User avatar
doublemax
Part Of The Furniture
Part Of The Furniture
 
Posts: 7151
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: avoid minimize window double click title bar

Postby ui-dev » Wed May 29, 2013 7:06 am

It works ! Thank you very much indeed :)
ui-dev
In need of some credit
In need of some credit
 
Posts: 3
Joined: Tue May 28, 2013 12:30 pm


Return to C++ Development

Who is online

Users browsing this forum: Google [Bot] and 10 guests