On Wed, Aug 27, 2008 at 3:11 PM, Paul McNett <[EMAIL PROTECTED]> wrote:
> Nate Lowrie wrote:
>> On Wed, Aug 27, 2008 at 2:43 PM, Paul McNett <[EMAIL PROTECTED]> wrote:
>>> Nate Lowrie wrote:
>>>> On Wed, Aug 27, 2008 at 2:19 PM, Paul McNett <[EMAIL PROTECTED]> wrote:
>>>>>> Well, I tracked this bug down!!!  Now, the only question is how to fix
>>>>>> it.  The cause for this bug is that the Form is catching the event and
>>>>>> not propagating it to the menus.  In dPemMixin.py, on line 370 we bind
>>>>>> the EVT_MENU_OPEN to the __wxMenuOpen function on line 512.  The open
>>>>>> event is firing on the form, but it is never making it to the menu.  I
>>>>>> have tried a couple of fixes but am getting nowhere.  Paul, Ed,
>>>>>> suggestions?
>>>>> Try this:
>>>>> ===================================================================
>>>>> --- dPemMixin.py        (revision 4468)
>>>>> +++ dPemMixin.py        (working copy)
>>>>> @@ -510,7 +510,7 @@
>>>>>
>>>>>
>>>>>         def __onWxMenuOpen(self, evt):
>>>>> -               self.raiseEvent(dEvents.MenuOpen, evt)
>>>>> +               evt.Menu.raiseEvent(dEvents.MenuOpen, evt)
>>>>>
>>>>>
>>>>>         def __onWxGotFocus(self, evt):
>>>> It works...I had to also do this though:
>>>>
>>>> ===================================================================
>>>> +++ C:\Documents and Settings\nwlowri\My
>>>> Documents\Projects\Personal\dabo-full\trunk\dabo\ui\uiwx\dMenu.py     Wed
>>>> Aug 27 14:25:05 2008
>>>> @@ -44,6 +44,7 @@
>>>>               uiApp = wx.GetApp()
>>>>               uiApp.Bind(wx.EVT_MENU_OPEN, self.__onWxMenuOpen)
>>>>               uiApp.Bind(wx.EVT_MENU_CLOSE, self.__onWxMenuClose)
>>>> +             self.bindEvent(dEvents.MenuOpen, self._onMenuHighlight)
>>>>               if self._useMRU:
>>>>                       self.bindEvent(dEvents.MenuOpen, self._onMenuOpenMRU)
>>>>
>>>> Does that affect Linux and Mac at all?  If not I will commit...
>>> Why does the menu open event (occurs when the menu is opened) get bound
>>> to a menu highlight handler? What is the definition of menu hilighting?
>>
>>
>> Refered to this comment by you in dMenuBar.py starting line 29:
>>
>>               ## pkm: EVT_OPEN only applies to the top-level menus: those in 
>> the menubar.
>>               ##      It seemed to me best to eliminate dEvents.MenuOpen and 
>> just call
>>               ##      dEvents.MenuHighlight instead. EVT_MENU_HIGHLIGHT 
>> never gets called
>>               ##      on top-level menus, so the two are mutually exclusive 
>> and kind of
>>               ##      mean the same thing. Let's keep it simple. BTW, I've 
>> never seen
>>               ##      a EVT_MENU_CLOSE being called, and 
>> EVT_MENU_HIGHLIGHT_ALL appears
>>               ##      to be identical to EVT_MENU_HIGHLIGHT. Therefore, as 
>> of this writing
>>               ##      we are exposing two menu events: dEvents.Hit and 
>> dEvents.Highlight.
>
> Okay, good enough! :)

Ran into a problem...This only works for top level menus.  If I append
a menu inside a menu and select it, I get this error:

Traceback (most recent call last):
  File "C:\Documents and Settings\nwlowri\My
Documents\Projects\Personal\dabo-full\trunk\dabo\ui\uiwx\dPemMixin.py",
line 514, in __onWxMenuOpen
    evt.Menu.raiseEvent(dEvents.MenuOpen, evt)
AttributeError: 'NoneType' object has no attribute 'raiseEvent'


_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: http://leafe.com/archives/byMID/[EMAIL PROTECTED]

Reply via email to