--时间轴控件用法
--2020-11-10  by: liang

function get_help(helpTime)
    --help需要特定的三列 start_time end_time color
    --start_time end_time为2020-11-11 07:00:00的时间格式
    --color为10进制色值,可使用cutil:
    helpTime:reset();
    helpTime:addField('test_col');
    helpTime:addField('color');
    helpTime:addField('start_time');
    helpTime:addField('end_time');
    local line = CVector();
        line:push_back('1');    line:push_back(ui:rgb(100, 110, 120));    
        line:push_back('2020-11-11 03:00:00');    line:push_back('2020-11-11 09:00:00');
    helpTime:addVectorValue(line);
        line:clear();
        line:push_back('1');    line:push_back(ui:rgb(100, 0, 0));    
        line:push_back('2020-11-11 09:00:00');    line:push_back('2020-11-11 12:10:00');
    helpTime:addVectorValue(line);
        line:clear();
        line:push_back('1');    line:push_back(ui:rgb(0, 110, 0));    
        line:push_back('2020-11-11 12:10:00');    line:push_back('2020-11-11 19:09:00');
    helpTime:addVectorValue(line);
        line:clear();
        line:push_back('1');    line:push_back(ui:rgb(0, 0, 120));    
        line:push_back('2020-11-11 19:09:00');    line:push_back('2020-11-12 04:00:00');
    helpTime:addVectorValue(line);
end

function main()
    --设置控件显示的开始时间
    ui:setProp('id_line_gauge', 'start_time', '2020-11-11 07:00:00');
    --设置控件要显示的总时长(单位小时)
    ui:setProp('id_line_gauge', 'length_time', '20');
    --上述设置的控件显示范围为:从2020-11-11 07:00:00到2020-11-12 03:00:00

    local helpTime = CSelectHelp();
    get_help(helpTime)
    helpTime:dump();
    ui:setHelp('id_line_gauge', helpTime);
end

main();
Copyright © TouchNet 2015 all right reserved,powered by Gitbook最后修订时间: 2022-06-21 09:21:04

results matching ""

    No results matching ""