开发者

wxpython: Guess if EVT_LIST_ITEM_ACTIVATED was triggered by ENTER or by DOUBLECLICK

开发者 https://www.devze.com 2023-03-20 02:21 出处:网络
In the ListCtrl widget, when a wx.EVT_LI开发者_运维技巧ST_ITEM_ACTIVATED event is processed in a callback function...

In the ListCtrl widget, when a wx.EVT_LI开发者_运维技巧ST_ITEM_ACTIVATED event is processed in a callback function...

How can I guess if the event was triggered by DOUBLECLICK or by ENTER KEY?

I need to distinguish them, something like:

def My_List_Item_Activated_CallBack( self, event ):

    if EVENT_WAS_TRIGGERED_BY_ENTER:
        print "triggered by enter"
    elif EVENT_WAS_TRIGGERED_BY_DCLICK:
        print "triggered by double click"

Thanks


I don't think that event has that kind of information. Why not just bind to EVT_LEFT_DCLICK and set some kind of flag that you can check in the handler for EVT_LIST_ITEM_ACTIVATED? If the flag isn't set, then you can assume the enter key was pressed. Of course, you'll need to reset the flag in the item activated handler.

0

精彩评论

暂无评论...
验证码 换一张
取 消