Showing 2 changed files with 14 additions and 16 deletions
+9 -3
Nasal/MFD.pages.nas
... ...
@@ -13,11 +13,17 @@ displayClass.setMFDPages = func {
13 13
         # build specific geometry per page, depending of number of sub-pages
14 14
         g.geometry = {x: 720, y: 758 - ((obj_s + 3) * 24), w: 300, l: obj_s + 1, sep: 1};
15 15
         # complete the hash with reccurrent elements type and callback
16
+        var firstEntry = 1;
16 17
         foreach (var o; g.objects) {
17
-            o.type = 'editable|end-of-line';
18
-            o.callback = me.device.buttons.MFD_page_wrapper;
18
+            if (contains(me.MFD, g.name) and contains(me.MFD[g.name], o.text)) {
19
+                o.type = firstEntry ? 'selected' : 'editable';
20
+                o.type ~= '|end-of-line';
21
+                o.callback = me.device.buttons.MFD_page_wrapper;
22
+                firstEntry = ! firstEntry;
23
+            }
24
+            else
25
+                o.type = 'normal|end-of-line';
19 26
         }
20
-        g.objects[0].type = 'selected|end-of-line';
21 27
     }
22 28
     # build the available groups line, at the bottom
23 29
     forindex (var g; me.device.data['page selection']) {
+5 -13
Nasal/buttons.nas
... ...
@@ -78,20 +78,12 @@ var buttonsClass = {
78 78
         var group = s.name;
79 79
         var subpage = s.objects[selected].text;
80 80
 
81
-        if (contains(me.device.display.MFD, group)) {
82
-            if (contains(me.device.display.MFD[group], subpage))
83
-                me.device.display.MFD[group][subpage]();
84
-            else
85
-                msg('page ' ~ group ~ '/' ~ subpage ~ ' not yet implemented');
86
-        }
87
-        else
88
-            msg('nothing is implemented yet in group ' ~ group);
89
-
90 81
         foreach (var k; keys(me.device.windows.window))
91
-            if (find(id, k) == 0)
92
-                me.device.windows.del(k);
93
-        me.device.buttons.ENT = func;
94
-        me.device.knobs.FmsInner = func;
82
+            if (find(id, k) == 0) {
83
+                me.device.windows.del(id);
84
+                break;
85
+            }
86
+        call(me.device.display.MFD[group][subpage], [], me);
95 87
     },
96 88
 
97 89
     MapMenu : func (a = 0) {