--单击事件
function click_id_btn_submit()

end
--关联按钮单击响应事件
ui:setClickEvent('id_btn_submit','click_id_btn_submit')--双击事件
function dblclick_id_edit()

end
--关联按钮双击响应事件
ui:setDoubleClickEvent('id_edit','dblclick_id_edit');



--选择变化,主要用于下拉框
function choose_combox()

end
--关联下拉框选择改变响应事件
ui:setSelChangeEvent('id_combox','choose_combox');



--值变化
function edit_value_change()

end
--关联输入框值改变响应事件
ui:setValueChangeEvent('id_edit','edit_value_change');



--右键事件
--右键菜单的各个点击事件方法
function click_tb_id_new_material_type()

end
--方法绑定菜单,参数1是菜单的cid,参数2是方法名,参数3是菜单项图标的图片路径,参数4是菜单项显示的名称
ui:addRightMenu('id_tree','click_tb_id_new_material_type','picture/common/toolbar/com_tool_new.png','新建');

function click_tb_id_modify_material_type()

end
ui:addRightMenu('id_tree','click_tb_id_modify_material_type','picture/common/toolbar/com_tool_modify.png','修改');

function click_tb_id_delete_material_type()

end
ui:addRightMenu('id_tree','click_tb_id_delete_material_type','picture/common/toolbar/com_tool_delete.png','删除');

function click_tb_id_refresh_material_type()

end
ui:addRightMenu('id_tree','click_tb_id_refresh_material_type','picture/common/toolbar/com_tool_refresh.png','刷新');

function click_tb_id_un_expand()

end
ui:addRightMenu('id_tree','click_tb_id_un_expand','picture/common/toolbar/com_tool_un_expand.png','收缩');

function click_tb_id_expand()

end
ui:addRightMenu('id_tree','click_tb_id_expand','picture/common/toolbar/com_tool_expand.png','展开');

--根据菜单id调用方法
function right_menu_click_id_material_type_tree(id,iMenuID)
    if (iMenuID == 'id_new_material_type') then
        click_tb_id_new_material_type();
    elseif (iMenuID == 'id_modify_material_type') then
        click_tb_id_modify_material_type();
    elseif (iMenuID == 'id_delete_material_type') then
        click_tb_id_delete_material_type();
    elseif (iMenuID == 'id_refresh_material_type') then
        click_tb_id_refresh_material_type();
    elseif (iMenuID == 'id_un_expand') then
        click_tb_id_un_expand();
    elseif (iMenuID == 'id_expand') then
        click_tb_id_expand();
    end
end
--设置右键菜单事件
ui:setRightMenuCilckEvent('id_tree','right_menu_click_id_material_type_tree');



--数字键盘点击事件简单写法
--根据按钮cid共性,提取公共方法
function click_bt_num(cid) --0到9的数字按钮
    local num = cutil:substr(cid,#cid-1,1);
    local sNum = ui:get('id_num');
    ui:set('id_num', sNum..num);
end

--循环里设置点击响应事件,少写代码
for i=0,9 do
    ui:setClickEvent('bt_num_'..i, 'click_bt_num');
end

function click_bt_clear() --清空数字
    ui:set('id_num','');
end
--设置清空数字的单击响应事件
ui:setClickEvent('bt_clear','click_bt_clear');

function click_bt_back() --回退
    local sNum = ui:get('id_num');
    if #sNum > 0 then
        ui:set('id_num', cutil:substr(sNum, 0, #sNum-1));
    end
end
--设置回退数字的单击响应事件
ui:setClickEvent('bt_back', 'click_bt_back');
Copyright © TouchNet 2015 all right reserved,powered by Gitbook最后修订时间: 2022-06-21 09:21:04

results matching ""

    No results matching ""