14.09.2010 21:46, Paul McNett пишет:
> On 9/14/10 11:42 AM, Stanislav Colotinschi wrote:
>
>> 14.09.2010 21:33, Paul McNett пишет:
>>
>>> On 9/14/10 11:24 AM, Stanislav Colotinschi wrote:
>>>
>>>
>>>> 14.09.2010 21:17, Paul McNett пишет:
>>>>
>>>>
>>>>> On 9/14/10 11:10 AM, Stanislav Colotinschi wrote:
>>>>>
>>>>>
>>>>>
>>>>>> Hi. I have such a question. I want to create a context menu for my grid.
>>>>>> I read some pages from the mailing list about it and I found that I
>>>>>> should use fillContextMenu. So I have a piece of code:
>>>>>>
>>>>>> mn = dabo.ui.dMenu()
>>>>>> mn.append(caption="Test")
>>>>>> grd = self.cltable
>>>>>> grd.fillContextMenu(mn)
>>>>>>
>>>>>>
>>>>>> That's all right, no errors, but when I click the right button of the
>>>>>> mouse, nothing happens. I tried to replace the last line with:
>>>>>>
>>>>>> grd.bindEvent(dabo.dEvents.GridMouseRightClick, grd.fillContextMenu(mn))
>>>>>>
>>>>>>
>>>>>>
>>>>> Try:
>>>>>
>>>>> grd.bindEvent(dabo.dEvents.GridMouseRightClick, grd.fillContextMenu)
>>>>>
>>>>> (bind the method, not the return value of calling the method)
>>>>>
>>>>>
>>>> Thanks, that works, but how can I define my context menu in
>>>> grd.fillContextMenu? I mean, can you give me a little example?
>>>>
>>>>
>>> You aren't seeing the "Test" menu item you defined?
>>>
>> Yes, and I can't understand how to get it working :(
>>
> I'm misunderstanding what is and isn't working. I think you see the "Test"
> menu item,
> but you haven't bound that menu item to a handler, like:
>
> mn.append(caption="Test", OnHit=self.onTestMenuHit)
>
> def onTestMenuHit(self, evt):
> print "Test hit!!!"
>
> Paul
> _______________________________________________
> 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]
>
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?
--
Regards
Stanislav Colotinschi
_______________________________________________
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]