Ed Leafe пишет:
On Oct 26, 2006, at 10:14 AM, Basil Shubin wrote:

Maybe there be possible a workaround? How to disabel this context menu?

The event is 'GridHeaderMouseRightClick', so in your grid class, you can do one of two things:

1) Remove the event binding in the afterInit() method by calling: self.unbindEvent(dabo.dEvents.GridHeaderMouseRightClick)

2) Define your own bound method to that event, and call the event's stop() method:

def on GridHeaderMouseRightClick(self, evt):
    evt.stop()

The first removes the built-in response of the grid to a header right click. The second leaves the binding in place, but stops the event from propagating up and executing the framework-level bindings.

I still got the same error, here a test programm:

import wx
import dabo

dabo.ui.loadUI("wx")

class GridTowns(dabo.ui.dGrid):

    def initProperties(self):
        self.DataSet = [{'town' : 'Moscow', 'country' : 'Russia'},
{'town' : 'Hollister', 'country' : 'United States'}]

        self.Editable = False
        self.Sortable = True
        self.Searchable = True

    def afterInit(self):
        GridTowns.doDefault()

        col = dabo.ui.dColumn(self, Name='Town', DataField='town',
                      Width=200, Caption=u"",
                      Sortable=True, Searchable=True, Editable=False)
        self.addColumn(col)

        col = dabo.ui.dColumn(self, Name='Country', DataField='country',
                      Width=175, Caption=u"",
                      Sortable=True, Searchable=True, Editable=False)
        self.addColumn(col)

        self.ShowRowLabels = False
        self.SelectionMode = 'Row'
        self.MultipleSelection = True

        self.unbindEvent(dabo.dEvents.GridHeaderMouseRightClick)

    def GridHeaderMouseRightClick(self, evt):
        evt.stop()

app = wx.App()

frm = wx.Frame(None, -1, "test")
grd = GridTowns(frm)
frm.Show()
app.MainLoop()


--
Basil Shubin
Freelance Software Developer


_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users

Reply via email to