Showing 1 changed files with 7 additions and 13 deletions
+7 -13
Nasal/MFD.pages.nas
... ...
@@ -8,27 +8,21 @@ displayClass.MFD = {
8 8
                 {text: 'DATA FIELD NUMBER', type: 'normal'},
9 9
                 {text: '  1 >', type: 'selected|end-of-line', choices: ['  1 >', '< 2 >', '< 3 >', '< 4  ']},
10 10
             ];
11
-            var lines = 2;
12 11
             var column = 0;
13 12
             var colmax = 5;
14 13
             foreach (var text; me.device.display.updateNavigationBox(1)) {
15 14
                 append(obj_infos, {
16
-                    text: text,
17
-                    type: column == colmax ? 'editable|end-of-line' : 'editable',
15
+                    text: sprintf('%-5s', text),
16
+                    type: 'editable' ~ ((column == colmax) ? '|end-of-line' : ''),
18 17
                     callback: func (id, selected) {
19
-                        var field = me.device.windows.state[id].objects[3].text;
20
-                        field = substr(field, 2);
21
-                        field = substr(field, 0, size(field) - 2);
22
-                        field = string.trim(field);
18
+                        var field = string.trim(me.device.windows.state[id].objects[3].text,
19
+                                                0,
20
+                                                func (c) c == `<` or c == `>` or c == ` `);
23 21
                         me.device.display.screenElements['DATA-FIELD' ~ field ~ '-ID-text']
24
-                            .setText(me.device.windows.state[id].objects[selected].text);
22
+                            .setText(string.trim(me.device.windows.state[id].objects[selected].text, 1));
25 23
                     }
26 24
                 });
27
-                if (column < colmax) column += 1;
28
-                else {
29
-                    column = 0;
30
-                    lines += 1;
31
-                }
25
+                column += (column < colmax) ? 1 : -column;
32 26
             }
33 27
             var windowId = 'SYSTEM SETUP';
34 28
             me.device.windows.draw( windowId, obj_infos );