PopupMenu problem was RE: [wxPython] Tip and Popup stuff

Ok here is the code snippet. This is part of a wxPanel that is embedded as a
widget (taken from demo) in an html page which is itself in the main App
window. Basically, nothing shows as I said.
#################START OF
CODE######################################################################
        #Pop Menu for Project Summary
        self.actions = wxMenu('Tools')
        
        summaryID = wxNewId()
        self.actions.Append(summaryID, 'Su&mmary', 'Create project Summary')
        EVT_MENU(self, summaryID, self.OnSummary)

    def OnSummary(self, evt):
        print "I have been clicked!"
        project = self.tree.GetItemText(self.tree.GetItemSelected())
        total_files = 0
        converted_files = 0
        for system in self._data[project].keys():
            total_files += len(self._data[project][system])
            for file in self._data[project][system].keys():
                if self._data[project][system][file][0] == 1:
                    converted_files += 1
                               
        message = "Summary for %s:\n" % project
        message += "\tTotal Files: %d\n" % total_files
        message += "\tConverted Files: %d\n" % converted_files
        dlg = wxMessageDialog(None, message, "%s"%project,
wxCENTRE>wxOK>wxICON_INFORMATION)
        dlg.ShowModal()
        
    def OnRightClick(self, event):
        pt = event.GetPosition();
        item, flags = self.tree.HitTest(pt)
        self.tree.SelectItem(item)
        
        if self.tree.GetItemText(item) in self.projects:
            self._parent.PopupMenu(self.actions, pt)
################################################END OF
CODE###############################################

···

-----Original Message-----
From: Robin Dunn [mailto:robin@alldunn.com]
Sent: October 24, 2001 1:17 PM
To: wxpython-users@lists.wxwindows.org
Subject: Re: PopupMenu problem was RE: [wxPython] Tip and Popup stuff

now I have a tree widget inside an html page contained in a top level
window.

From the tree element, I call on right-click popupmenu and do things when
menu item (one for now) is clicked.

But nothing happens. I even created a stupid function that only does:

print

"Hello, I have been clicked!" and nothing happens.

Any idea?

Not without seeing a small sample of how you are trying to do this.

--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters?
http://wxPython.org Relax with wxPython!

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

        self.actions = wxMenu('Tools')
        summaryID = wxNewId()
        self.actions.Append(summaryID, 'Su&mmary', 'Create project

Summary')

        EVT_MENU(self, summaryID, self.OnSummary)

...

        if self.tree.GetItemText(item) in self.projects:
            self._parent.PopupMenu(self.actions, pt)

SInce the event handler is bound to self then you need to use self.PopupMenu
for the event to be delivered to it. As you have it the event is being sent
to self._parent and it will go up the containment tree from there, never
getting to self.

···

--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters?
http://wxPython.org Relax with wxPython!

Thanks,

that was a really dumb error!!!!!!!!!

···

On Wed, 2001-10-24 at 14:06, Robin Dunn wrote:

> self.actions = wxMenu('Tools')
> summaryID = wxNewId()
> self.actions.Append(summaryID, 'Su&mmary', 'Create project
Summary')
> EVT_MENU(self, summaryID, self.OnSummary)
>
...

> if self.tree.GetItemText(item) in self.projects:
> self._parent.PopupMenu(self.actions, pt)

SInce the event handler is bound to self then you need to use self.PopupMenu
for the event to be delivered to it. As you have it the event is being sent
to self._parent and it will go up the containment tree from there, never
getting to self.

--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters?
http://wxPython.org Relax with wxPython!

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

Thanks,

that was a really dumb error!!!!!!!!!

Everybody gets to have one, but that's all! <wink>

···

--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters?
http://wxPython.org Relax with wxPython!