zkv1000 / Nasal / MFD.pages.nas /
5b3eb6d 7 years ago
1 contributor
35 lines | 1.584kb
displayClass.MFD = {
    NRST: {
        'NEAREST VOR' : func {
            # just a POC
            print('here there will be a page for searching nearest VORs');
        },
    },
};

displayClass.setMFDPages = func {
    foreach (var g; me.device.data['page selection']) {
        var obj_s = size(g.objects);
        # build specific geometry per page, depending of number of sub-pages
        g.geometry = {x: 720, y: 758 - ((obj_s + 3) * 24), w: 300, l: obj_s + 1, sep: 1};
        # complete the hash with reccurrent elements type and callback
        foreach (var o; g.objects) {
            o.type = 'editable|end-of-line';
            o.callback = me.device.buttons.MFD_page_wrapper;
        }
        g.objects[0].type = 'selected|end-of-line';
    }
    # build the available groups line, at the bottom
    forindex (var g; me.device.data['page selection']) {
        append(me.device.data['page selection'][g].objects, {type: 'separator'});
        for (var i = 0; i < g; i+=1)
            append(me.device.data['page selection'][g].objects,
                {text: me.device.data['page selection'][i].name, type: 'normal'});
        append(me.device.data['page selection'][g].objects,
            {text: me.device.data['page selection'][i].name, type: 'highlighted'});
        for (var i = g+1; i < size(me.device.data['page selection']); i+=1)
            append(me.device.data['page selection'][g].objects,
                {text: me.device.data['page selection'][i].name, type: 'normal'});
    }
    me.device.knobs.FmsOuter = me.device.knobs.MFD_select_page_group;
};