On Sep 14, 2010, at 2:53 PM, Stanislav Colotinschi wrote:

> Sorry, I didn't explain the problem as good as I should do it. I can't 
> see the menu, and I always see an error in the console:
> 
> TypeError: fillContextMenu() takes exactly 1 argument (2 given)
> 
> 
> having the code:
> 
>             mb = dabo.ui.dForm()
>             mb.append(caption="Test")
>             mb = self.cltable.fillContentMenu(mb)
>             
> self.cltable.bindEvent(dabo.dEvents.GridMouseRightClick,self.cltable.fillContextMenu)
> 
> That code is a part of the afterInitAll method of my main form. I am 
> probably doing something wrong. Can you help me?


        First off, 'fillContextMenu()' is simply a hook, or convenience method; 
you don't need to use it at all, and, in fact, I completely forgot it existed. 
The method that you typically use to display a context menu is (surprise!) 
'showContextMenu()'.

        Here's a typical usage: 

def onContextMenu(self, evt):
        menu = dabo.ui.dMenu()
        menu.append("Test", ...)
        menu.append("Test2", ...)
        self.showContextMenu(menu)

        What this code does is:
a) handle the context menu event. This is better than handling right-click, 
since Windows users also have a context menu button that can raise the event.
b) creates the menu
c) appends two items
d) shows the context menu at the current mouse position

        This code will work for all controls, not just grids. By default, 
showContextMenu() will show the menu at the current mouse location, but you can 
also show it at any position by passing an (x,y) tuple after the menu argument. 
Also by default, the menu is destroyed once the user dismisses it; if you wish 
to re-use a menu, add "release=False" to the showContextMenu() call.



-- Ed Leafe



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

Reply via email to