Frame sytle on windows Topic is solved

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.
Post Reply
Lamego
Earned some good credits
Earned some good credits
Posts: 101
Joined: Wed Jun 29, 2005 10:13 pm
Location: Portugal
Contact:

Frame sytle on windows

Post by Lamego »

Hello,
I am trying to create a fixed size frame showing only the close button.

The following works fine on Linux wxGTK :

Code: Select all

frmLogin::frmLogin(const wxString& title, const wxPoint& pos, const wxSize& size)
  : wxFrame(NULL, wxID_ANY, title, pos, size wxSYSTEM_MENU | wxCLOSE_BOX )
However on Windows XP the window doesn't get a system menu (no close button), also I am unable to move the window and it shows the symbol on the corner as if would be resizable (but it doesn't resize).

Any ideas ?
User avatar
T-Rex
Moderator
Moderator
Posts: 1249
Joined: Sat Oct 23, 2004 9:58 am
Location: Zaporizhzhya, Ukraine
Contact:

Post by T-Rex »

wxSYSTEM_MENU | wxCLOSE_BOX | wxCAPTION
leio
Can't get richer than this
Can't get richer than this
Posts: 802
Joined: Mon Dec 27, 2004 10:46 am
Location: Estonia, Tallinn
Contact:

Post by leio »

You should use the wxDEFAULT_FRAME_STYLE flag always. If you need something of it not included (such as the wxMINIMIZE_BOX flag), you can do bitwise operations on it.
For example, the style argument could be:
wxDEFAULT_FRAME_STYLE & ~(wxMINIMIZE_BOX | wxMAXIMIZE_BOX) | wxSTAY_ON_TOP

This would give the default frame style without the minimize and maximize boxes (disregarding any kind of usability concerns here for the sake of example), together with the wxSTAY_ON_TOP style.
Compilers: gcc-3.3.6, gcc-3.4.5, gcc-4.0.2, gcc-4.1.0 and MSVC6
OS's: Gentoo Linux, WinXP; WX: CVS HEAD

Project Manager of wxMUD - http://wxmud.sf.net/
Developer of wxGTK;
gtk+ port maintainer of OMGUI - http://www.omgui.org/
Lamego
Earned some good credits
Earned some good credits
Posts: 101
Joined: Wed Jun 29, 2005 10:13 pm
Location: Portugal
Contact:

ok

Post by Lamego »

Adding the the wxCAPTION did the trick, there should be some warning on the documentation about the wxSYSTEM_MENU not working on Windows or that it depends on wxCAPTION beeing also present on the flags.

About the wxDEFAULT_FRAME_STYLE I don't agree, what benefits do I get from using the default style, is it a plataform specific default? One should be able to give a custom style with the features we want for our frame, in my opinion thats the purpose of styles, to define our own style not to just change the default style.
But yes it would also resolve my problem because it would include the wxCAPTION option.
leio
Can't get richer than this
Can't get richer than this
Posts: 802
Joined: Mon Dec 27, 2004 10:46 am
Location: Estonia, Tallinn
Contact:

Post by leio »

Yes, it is a platform specific default.
Also, new styles might be added, that before were just on by default - then you might loose it.
This happened with wxCLOSE_BOX in 2.4 -> 2.6 - applications that didn't use the wxDEFAULT_FRAME/DIALOG_STYLE just happened to loose the close box, because it always existed on 2.4, but was made possible to be omitted with 2.6. If they had used the wxDEFAULT_FRAME_STYLE concept, they wouldn't have had problems.
Compilers: gcc-3.3.6, gcc-3.4.5, gcc-4.0.2, gcc-4.1.0 and MSVC6
OS's: Gentoo Linux, WinXP; WX: CVS HEAD

Project Manager of wxMUD - http://wxmud.sf.net/
Developer of wxGTK;
gtk+ port maintainer of OMGUI - http://www.omgui.org/
Lamego
Earned some good credits
Earned some good credits
Posts: 101
Joined: Wed Jun 29, 2005 10:13 pm
Location: Portugal
Contact:

Ok

Post by Lamego »

Ok, if it's plataform specific it makes sense to use it.
Thanks for the info.
wxMSW 2.6.3 - GCC 3.4.2 (MinGW/MSYS)
wxGTK 2.6.3 - GCC 4.02 (Ubuntu)
Code::Blocks Win/Lin
PTlink Tech Admin
PTlink Chat Software Lead Developer
http://software.pt-link.net
Post Reply