I think you'll find this StackOverflow thread useful: http://stackoverflow.com/questions/3243495/wxpython-context-help
From the wxFrame docs:
"""
wxFRAME_EX_CONTEXTHELP Under Windows, puts a query button on the
caption. When pressed, Windows will go into a context-sensitive help
mode and wxWidgets will send a wxEVT_HELP event if the user clicked on
an application window. Note that this is an extended style and must be
set by calling SetExtraStyle before Create is called (two-step
construction). You cannot use this style together with wxMAXIMIZE_BOX or
wxMINIMIZE_BOX, so you should use wxDEFAULT_FRAME_STYLE & ~
(wxMINIMIZE_BOX | wxMAXIMIZE_BOX) for the frames having this style (the
dialogs don't have a minimize or a maximize box by default)
"""
Apparently the part about needing to remove the min/max styles and using
2-phase create is no longer true, but it is clear that the min/max boxes
can not be used at the same time as the built-in context help button.
My guess is that it is a limitation imposed by Microsoft.
If you need to keep the ability to minimize and maximize the frame then
use a wx.ContextHelpButton within the frame's contents instead.
--
Robin Dunn
Software Craftsman
http://wxPython.org
On 5/22/11 6:05 AM, cool-RR wrote:
On Sun, May 22, 2011 at 4:52 AM, Boštjan Mejak <bostja...@gmail.com<mailto:bostja...@gmail.com>> wrote:
I think you'll find this StackOverflow thread useful:
http://stackoverflow.com/questions/3243495/wxpython-context-help
I ran it and it has the same problem: It makes a frame with a question
mark button but without minimize/maximize buttons.
From the wxFrame docs:
"""
wxFRAME_EX_CONTEXTHELP Under Windows, puts a query button on the caption. When pressed, Windows will go into a context-sensitive help mode and wxWidgets will send a wxEVT_HELP event if the user clicked on an application window. Note that this is an extended style and must be set by calling SetExtraStyle before Create is called (two-step construction). You cannot use this style together with wxMAXIMIZE_BOX or wxMINIMIZE_BOX, so you should use wxDEFAULT_FRAME_STYLE & ~ (wxMINIMIZE_BOX | wxMAXIMIZE_BOX) for the frames having this style (the dialogs don't have a minimize or a maximize box by default)
"""
Apparently the part about needing to remove the min/max styles and using 2-phase create is no longer true, but it is clear that the min/max boxes can not be used at the same time as the built-in context help button. My guess is that it is a limitation imposed by Microsoft.
If you need to keep the ability to minimize and maximize the frame then use a wx.ContextHelpButton within the frame's contents instead.
--
Robin Dunn
So how would you code such a frame then? Please give a code snippet example. For noobs like myself to learn.
It depends on what else will be in the frame, you just add a
wx.ContextHelpButton inside the frame somewhere like any other button,
however it best fits within the UI.
That creates the button. You still need to create a help provider, set
help text on items, etc. See the ContextHelp sample in the demo or even
the stackoverflow example you pointed to earlier.
> window = MyFrame(parent=None,
> style=wx.DEFAULT_FRAME_STYLE |
> wx.FRAME_EX_CONTEXTHELP)
>
> But this does *not* work. There's just no context help button besides
> the minimize, maximize, and close button. (Windows user here.) What can
> we do to make it appear?
As stated in the docs the wx.FRAME_EX_CONTEXTHELP style is an *extra*
style, so it has to be set with SetExtraStyle.
> Then how to make it respond to a user click and
> to generate some event?
Take a look at the sample in the demo.
You can't. That is what the rest of this thread has been about.
I see. How are other people implementing this button right there besides the X button then?
-- Tim Roberts, ti...@probo.com Providenza & Boekelheide, Inc.
As has been mentioned a couple times already in this thread, you use the
extra style on the frame to get the context help button on the caption
bar, but because of a limitation imposed by microsoft you can not have
the minimize and maximize buttons at the same time as the help button.
But... Is there a workaround?