Overriding OnMenuHighlight on Windows

I'm trying to get the help text from my menubar menus to *not* mess with
the statusbar. (By default, selecting a menu item in the menubar puts
it's help text in the first statusbar field.) I'm doing this:

  class MyFrame(wx.Frame):
    def __init__(self, parent, id, title):
      ...
      self.Bind(wx.EVT_MENU_HIGHLIGHT, self.OnMenuHighlight)
      ...

    def OnMenuHighlight(self, evt):
      print "Don't stomp on my statusbar!"

This works as expected in Linux(statusbar is untouched) but on Windows,
the help text still appears in the statusbar. How do I tell the menubar
to not touch the statusbar? Should I file this as a bug in wxPython
on Windows?

- Ryan

Hello,

···

On Wed, May 20, 2009 at 4:34 PM, Ryan Nowakowski <tubaman@fattuba.com> wrote:

I'm trying to get the help text from my menubar menus to *not* mess with
the statusbar. (By default, selecting a menu item in the menubar puts
it's help text in the first statusbar field.) I'm doing this:

   class MyFrame\(wx\.Frame\):
           def \_\_init\_\_\(self, parent, id, title\):
                   \.\.\.
                   self\.Bind\(wx\.EVT\_MENU\_HIGHLIGHT, self\.OnMenuHighlight\)
                   \.\.\.

           def OnMenuHighlight\(self, evt\):
                   print &quot;Don&#39;t stomp on my statusbar\!&quot;

This works as expected in Linux(statusbar is untouched) but on Windows,
the help text still appears in the statusbar. How do I tell the menubar
to not touch the statusbar? Should I file this as a bug in wxPython
on Windows?

Doing exactly as you have above work fine for me on windws xp /
wxPython 2.8.9.2.

What version of wxPython are you using? Can you make a small runnable
sample that illustrates the problem
(http://wiki.wxpython.org/MakingSampleApps)?

Cody

Here's a sample that doesn't mess with my statusbar text on Linux but
causes the statusbar to go blank on Windows:

  import wx

  class MyFrame(wx.Frame):
    def __init__(self, parent, id, title):
      wx.Frame.__init__(self, parent, id, title)

      self.SetMenuBar(self.createMenuBar())
      self.Bind(wx.EVT_MENU_HIGHLIGHT, self.OnMenuHighlight)

      self.SetStatusBar(self.createStatusBar())

    def createMenuBar(self):
      menuBar = wx.MenuBar()
      menu = wx.Menu()
      menu.Append(-1, "Stomp", "Stomp!")
      menuBar.Append(menu, "Test")
      return menuBar

    def createStatusBar(self):
      statusBar = wx.StatusBar(self)
      statusBar.SetStatusText("This is my status text")
      return statusBar

    def OnMenuHighlight(self, evt):
      print "Don't stomp on my statusbar"
      
  if __name__ == "__main__":
    app = wx.PySimpleApp()
    frame = MyFrame(None, -1, "Statusbar Stompage")
    frame.Show()
    app.MainLoop()

- Ryan

···

On Wed, May 20, 2009 at 04:53:20PM -0500, Cody Precord wrote:

Hello,

On Wed, May 20, 2009 at 4:34 PM, Ryan Nowakowski <tubaman@fattuba.com> wrote:
> I'm trying to get the help text from my menubar menus to *not* mess with
> the statusbar. (By default, selecting a menu item in the menubar puts
> it's help text in the first statusbar field.) I'm doing this:
>
> class MyFrame(wx.Frame):
> def __init__(self, parent, id, title):
> ...
> self.Bind(wx.EVT_MENU_HIGHLIGHT, self.OnMenuHighlight)
> ...
>
> def OnMenuHighlight(self, evt):
> print "Don't stomp on my statusbar!"
>
>
>
> This works as expected in Linux(statusbar is untouched) but on Windows,
> the help text still appears in the statusbar. How do I tell the menubar
> to not touch the statusbar? Should I file this as a bug in wxPython
> on Windows?

Doing exactly as you have above work fine for me on windws xp /
wxPython 2.8.9.2.

What version of wxPython are you using? Can you make a small runnable
sample that illustrates the problem
(http://wiki.wxpython.org/MakingSampleApps)?

Cody
_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

I'm running wxPython 2.8.9.2

···

On Wed, May 20, 2009 at 04:53:20PM -0500, Cody Precord wrote:

Hello,

On Wed, May 20, 2009 at 4:34 PM, Ryan Nowakowski <tubaman@fattuba.com> wrote:
> I'm trying to get the help text from my menubar menus to *not* mess with
> the statusbar. (By default, selecting a menu item in the menubar puts
> it's help text in the first statusbar field.) I'm doing this:
>
> class MyFrame(wx.Frame):
> def __init__(self, parent, id, title):
> ...
> self.Bind(wx.EVT_MENU_HIGHLIGHT, self.OnMenuHighlight)
> ...
>
> def OnMenuHighlight(self, evt):
> print "Don't stomp on my statusbar!"
>
>
>
> This works as expected in Linux(statusbar is untouched) but on Windows,
> the help text still appears in the statusbar. How do I tell the menubar
> to not touch the statusbar? Should I file this as a bug in wxPython
> on Windows?

Doing exactly as you have above work fine for me on windws xp /
wxPython 2.8.9.2.

What version of wxPython are you using? Can you make a small runnable
sample that illustrates the problem
(http://wiki.wxpython.org/MakingSampleApps)?

Ryan Nowakowski wrote:

Here's a sample that doesn't mess with my statusbar text on Linux but
causes the statusbar to go blank on Windows:

It seems to be blanking before the EVT_MENU_HIGHLIGHT event, and perhaps even before the EVT_MENU_OPEN event. I think this is a regression, please enter a trac ticket about it. In the meantime you can restore the text in your OnMenuHighlight event handler as a workaround.

···

--
Robin Dunn
Software Craftsman

http://trac.wxwidgets.org/ticket/10822

···

On Wed, May 20, 2009 at 08:07:18PM -0700, Robin Dunn wrote:

Ryan Nowakowski wrote:

Here's a sample that doesn't mess with my statusbar text on Linux but
causes the statusbar to go blank on Windows:

It seems to be blanking before the EVT_MENU_HIGHLIGHT event, and perhaps
even before the EVT_MENU_OPEN event. I think this is a regression,
please enter a trac ticket about it. In the meantime you can restore
the text in your OnMenuHighlight event handler as a workaround.