Hey,
When I do self.SetExtraStyle(wx.FRAME_EX_CONTEXTHELP)
on a frame, the minimize/maximize buttons disappear. Why? How can I have all buttons?
(Win XP.)
Thanks,
Ram.
Hey,
When I do self.SetExtraStyle(wx.FRAME_EX_CONTEXTHELP)
on a frame, the minimize/maximize buttons disappear. Why? How can I have all buttons?
(Win XP.)
Thanks,
Ram.
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.
Ram.
On Sun, May 22, 2011 at 4:52 AM, Boštjan Mejak bostjan.mejak@gmail.com wrote:
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.
On 5/22/11 6:05 AM, cool-RR wrote:
On Sun, May 22, 2011 at 4:52 AM, Boštjan Mejak <bostjan.mejak@gmail.com > <mailto:bostjan.mejak@gmail.com>> wrote:
I think you'll find this StackOverflow thread useful:
python - wxPython: Context dialog popup - Stack OverflowI ran it and it has the same problem: It makes a frame with a question
mark button but without minimize/maximize buttons.
--
Robin Dunn
Software Craftsman
I think you'll find this StackOverflow thread useful: [http://stackoverflow.com/questions/3243495/wxpython-context-help](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.
Unfortunately you’re right, as described in this MSDN document:
http://msdn.microsoft.com/en-us/library/ms632600(v=vs.85).aspx
Quote: “The window has a maximize button. Cannot be combined with the WS_EX_CONTEXTHELP style.”
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
Thanks,
Ram.
On Sun, May 22, 2011 at 10:13 PM, Robin Dunn robin@alldunn.com wrote:
On 5/22/11 6:05 AM, cool-RR wrote:
On Sun, May 22, 2011 at 4:52 AM, Boštjan Mejak <bostjan.mejak@gmail.com > > mailto:bostjan.mejak@gmail.com> wrote:
So how would you code such a frame then? Please give a code snippet example. For noobs like myself to learn.
I didn’t understand (1) whether the question was directed at me and (2) what exactly you mean by “such a frame”.
Ram.
On Mon, May 23, 2011 at 12:41 AM, Boštjan Mejak bostjan.mejak@gmail.com wrote:
So how would you code such a frame then? Please give a code snippet example. For noobs like myself to learn.
By “such a frame” I mean how would the subclass of wx.Frame be.
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.
On 5/22/11 6:02 PM, Bo�tjan Mejak wrote:
By "such a frame" I mean how would the subclass of wx.Frame be.
--
Robin Dunn
Software Craftsman
Do you think it would be done like this?
class MyFrame(wx.Frame):
def init(self, *args, **kwargs):
helpButtonOnFrame = wx.ContextHelpButton(self)
Would that suffice? Other code follows of course, but would you say that this would be enough? Assuming Windows OS.
I thought in these lines…
import wx
class MyFrame(wx.Frame):
def init(self, *args, **kwargs):
wx.Frame.init(self, *args, **kwargs)
if name == ‘main’:
app = wx.App(redirect=False)
window = MyFrame(parent=None,
style=wx.DEFAULT_FRAME_STYLE | wx.FRAME_EX_CONTEXTHELP)
window.Center()
window.Show()
app.MainLoop()
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? Then how to make it respond to a user click and to generate some event?
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.
On 5/23/11 12:51 AM, Bo�tjan Mejak wrote:
Do you think it would be done like this?
class MyFrame(wx.Frame):
def __init__(self, *args, **kwargs):
helpButtonOnFrame = wx.ContextHelpButton(self)Would that suffice? Other code follows of course, but would you say that
this would be enough? Assuming Windows OS.
--
Robin Dunn
Software Craftsman
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.
On 5/23/11 1:12 AM, Bo�tjan Mejak wrote:
--
Robin Dunn
Software Craftsman
Ah yes, Robin, I see what you mean. What I wanna know is how to put that ‘?’ button besides the minimize button, maximize button, and the X button in the top-right place of the frame.
You can't. That is what the rest of this thread has been about.
On 5/23/11 12:06 PM, Bo�tjan Mejak wrote:
Ah yes, Robin, I see what you mean. What I wanna know is how to put that
'?' button besides the minimize button, maximize button, and the X
button in the top-right place of the frame.
--
Robin Dunn
Software Craftsman
I see. How are other people implementing this button right there besides the X button then?
Bo�tjan Mejak wrote:
I see. How are other people implementing this button right there
besides the X button then?
Do you have an example?� In all the cases I've seen, that ? button
is only displayed on dialogs, where you don’t have or need Minimize
and Maximize buttons.� An application is expected to have a “Help”
menu item.
In a C++ application, you can take over all the drawing of the
“non-client” areas yourself (that includes the title bar, buttons,
and decorations) and do whatever you want, but users don’t expect to
see the ? button up there on application windows.
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.
On 5/23/11 12:47 PM, Bo�tjan Mejak wrote:
I see. How are other people implementing this button right there besides
the X button then?
--
Robin Dunn
Software Craftsman
Aha! Now I get it! Thanks for clearing that up.
But… Is there a workaround?