【问题标题】:What is the Python syntax of Ti.API.fireEvent?Ti.API.fireEvent 的 Python 语法是什么?
【发布时间】:2012-11-17 13:03:56
【问题描述】:

具体来说,我需要 Python 等价物:

Ti.API.fireEvent('custom_event', { row_id : 10; });

我试过这个:

Ti.API.fireEvent('custom_event', { 'row_id' : 10 })

但是,我无法在侦听器端检索参数值。这一定是 dict-KObject 转换的问题,我无法弄清楚。

【问题讨论】:

    标签: python titanium tidesdk


    【解决方案1】:

    我认为你可以这样做:

    // listen:
    Ti.API.addEventListener("sEventName",function(e){
        var sValue = Ti.API.get("keyName");
        Ti.API.info(sValue);
    });
    
    // fire:
    Ti.API.set("keyName","value goes here");
    Ti.API.fireEvent("sEventName");
    

    【讨论】:

      【解决方案2】:

      应该是 Ti.App.fireEvent() 而不是 Ti.API.fireEvent()

      【讨论】:

      猜你喜欢
      • 2015-09-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-09-11
      • 1970-01-01
      • 2014-03-31
      • 1970-01-01
      相关资源
      最近更新 更多