Hey r_gigante,
thank you for your reply, I think I am doing something wrong:
I have this code in the Message function of my dialogwhere 10002 is the ID of a Group in my Layout:
def Message(self, msg, result):
# this will crash c4d with the commander window
state = c4d.BaseContainer()
self.GetInputState(c4d.BFM_INPUT_MOUSE, c4d.BFM_INPUT_MOUSERIGHT, state)
if state.GetInt32(c4d.BFM_INPUT_VALUE) == True:
x = state.GetInt32(c4d.BFM_INPUT_X)
y = state.GetInt32(c4d.BFM_INPUT_Y)
g2l = self.Global2Local()
x += g2l['x']
y += g2l['y']
print "Found rightclick in dialog"
print "X: " +str(x)
print "Y: " +str(y)
print self.GetItemDim(10002)
if self.GetPositionInGuiArea(10002, x, y):
IDM_MENU1 = c4d.FIRST_POPUP_ID
IDM_MENU2 = c4d.FIRST_POPUP_ID+1
IDM_MENU3 = c4d.FIRST_POPUP_ID+2
menu = c4d.BaseContainer()
menu.InsData(IDM_MENU1, 'Menu 1')
menu.InsData(IDM_MENU2, 'Menu 2')
menu.InsData(IDM_MENU3, 'Menu 3')
l2s = self.Local2Screen()
print str(x+l2s['x']) + " :: " + str(y+l2s['y'])
result = gui.ShowPopupDialog(cd=None, bc=menu, x=x+l2s['x'], y=y+l2s['y'])
self.KillEvents()
print result
return gui.GeDialog.Message(self, msg, res)
This code will still open the default popup menu - I tried with self as well as the basecall c4d.gui.GeDialog.KillEvents(). C4D will open my menu but it wil sometimes also open the default context menu after clicking something in the menu or canceling the rightclick with esc.
Could you maybe provide an example?