Dear Vlastimil,
Thank you for your experiment. Alas it is not the solution. The wx.SYSTEM_MENU is still present on the left corner of the title bar !
If you refer to
http://msdn.microsoft.com/en-us/library/ms632597(VS.85).aspx
you will see that Microsoft calls this the “Application Icon”. When you right-click on it, you have the usual menu (restore, minimize, maximize, move, close, …), hence I guess the name “System Menu”.
I have tried to find the answer by looking in the code, but I’m too new to the subject matter to understand something. There are 2 files: _windows.py and windows.pyd dealing with this. Within the _windows.py, if you search for CLOSE_BOX, you find a line of code refering to a CLOSE_BOX in windows. Unfortunately, the windows.pyd is a DLL and can’t be read as a .py file. I looked at the source code on the wxpython.org website. My understanding is that the DLL is compiled from the windows.wrap.cpp found in
http://svn.wxwidgets.org/viewvc/wx/wxPython/trunk/src/msw/
which itself is generated from … ? I don’t know … I’m lost here. I thought it might come from the windows.cpp file in the wxWidgets files but there is no trace of CLOSE_BOX in that file. So, I can’t investigate further …
Strangely enough, I looked at the window styles available in the WinAPI of Microsoft and I find the following ones which are very similar in purpose and intend to our wx.STYLES
WS_BORDER
Creates a window that has a thin-line border.
WS_CAPTION
Creates a window that has a title bar (includes the WS_BORDER style).
WS_SYSMENU
Creates a window that has a window menu on its title bar. The WS_CAPTION style must also be specified.
but … how come !? … there is no WS_CLOSEBOX !!! There is well a WS_MINIMIZEBOX and WS_MAXIMIZEBOX but NO WS_CLOSEBOX !!! I’m perplexed.
Well, my concluding hypothesis are the following:
- There is no WS_CLOSEBOX defined within WinAPI, meaning that for Micorsoft a SYSTEM_MENU includes as a bare minimum a close function that is automatically duplicated in a close icon (the X in the upper right corner). Indeed, if one specifies only:
" style = wx.CAPTION | wx.SYSTEM_MENU "
then the menu box appears on the left side (but the close choice is greyed) and the X icon appears in the right corner but is greyed (or dimmed) making the close function unavailable.
-
The wx.CLOSE_BOX doesn’t draw an X icon in the upper right corner but probably enables the close function, to which MS responds by making the icon active (bright instead of dimm) and rending the close choice readable (black instead of grey) in the system menu.
-
The wx.CLOSE_BOX argument is thus very different by its role from the wx.MINIMIZE_BOX and wx.MAXIMIZE_BOX, which themselves are real orders to draw the corresponding icons in an enabled fashion, both requiring the wx.SYSTEM_MENU style too.
For a definitive opinion, one needs more clarification from experts.
Good evening,
Rene
PS: If you are curious, you can decompose wx.DEFAULT_FRAME_STYLE (=541,072,960) into its constituent bits wx.CAPTION (bit 29), wx.CLIP_CHILDREN (bit 22), wx.CLOSE_BOX (bit 12), wx.SYSTEM_MENU (bit 11), wx.MINIMIZE_BOX (bit 10), wx.MAXIMIZE_BOX (bit 9), wx.RESIZE_BORDER (bit 6). This info is useless (e.g. print wx.CLOSE_BOX gives 4096) except that you can find if a mask or flag is either a single bit (a power of 2) or a combination of bits.
···
On Thu, Apr 16, 2009 at 8:55 PM, Vlastimil Brom vlastimil.brom@gmail.com wrote:
2009/4/16 Rene Heymans rene.heymans@gmail.com:
Dear All,
I’m trying to find out what style must I define to only have a title and a
close box in a frame.
…
Thank you in advance,
Regards, Rene
PS: I referred to pages 228-229 of wxPython In Action. Could not figure out
the solution. myf2 is the example shown in figure 8.3 on page 228
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users
Hi Rene,
does
myf1 = wx.Frame(okno, -1, ‘1er cadre’, style = wx.SYSTEM_MENU
wx.CAPTION | wx.CLOSE_BOX)
create the frame style you need?
I’m not quite sure, how the SYSTEM_MENU is connected with the other
styles, I just experimented with the default frame style -
wxDEFAULT_FRAME_STYLE gradually removing some styles.
cf. http://docs.wxwidgets.org/2.8.0/wx_wxframe.html
hth
vbr
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users