dblume commited on 2023-01-25 23:11:05
Showing 3 changed files, with 53 additions and 18 deletions.
| ... | ... |
@@ -36,7 +36,7 @@ function init() |
| 36 | 36 |
m.updates_right_title = m.top.findNode("updates_right_title")
|
| 37 | 37 |
m.updates_right_title.font.size=title_font_size |
| 38 | 38 |
m.updates_right_title.color="0x62E7FFFF" |
| 39 |
- m.updates_right_title.text = "Test Output" |
|
| 39 |
+ m.updates_right_title.text = "Test Output (Press OK to run test)" |
|
| 40 | 40 |
|
| 41 | 41 |
m.title_color = "0x20204080" |
| 42 | 42 |
m.title_focus_color = "0x4060B0A0" |
| ... | ... |
@@ -70,10 +70,14 @@ function init() |
| 70 | 70 |
texttimer.observeField("fire", "timerUpdate")
|
| 71 | 71 |
texttimer.control = "start" |
| 72 | 72 |
|
| 73 |
+ m.rightLineCount = 100 |
|
| 74 |
+ m.rightVisibleLines = 21 |
|
| 75 |
+ m.rightTopVisibleLine = 0 |
|
| 73 | 76 |
m.updates_lower_array = CreateObject("roArray", 10, true)
|
| 74 |
- m.updates_right_array = CreateObject("roArray", 21, true)
|
|
| 77 |
+ m.updates_right_array = CreateObject("roArray", m.rightLineCount, true)
|
|
| 75 | 78 |
|
| 76 | 79 |
m.focus_rect = 1 |
| 80 |
+ m.prevLeftFocus = 0 |
|
| 77 | 81 |
doUpdateFocus() |
| 78 | 82 |
|
| 79 | 83 |
m.top.setFocus(true) |
| ... | ... |
@@ -112,12 +116,30 @@ function updateTextLower(s as String) as void |
| 112 | 116 |
end function |
| 113 | 117 |
|
| 114 | 118 |
|
| 119 |
+function showTextRight() as void |
|
| 120 |
+ visibleWindow = [] |
|
| 121 |
+ max = m.updates_right_array.Count() - m.rightTopVisibleLine |
|
| 122 |
+ if max > m.rightVisibleLines then |
|
| 123 |
+ max = m.rightVisibleLines |
|
| 124 |
+ end if |
|
| 125 |
+ for i = 0 to max - 1 |
|
| 126 |
+ visibleWindow.Push(m.updates_right_array[m.rightTopVisibleLine + i]) |
|
| 127 |
+ end for |
|
| 128 |
+ m.updates_right.text = visibleWindow.Join(chr(10)) |
|
| 129 |
+end function |
|
| 130 |
+ |
|
| 131 |
+ |
|
| 115 | 132 |
function onUpdateTextRight() as void |
| 116 |
- while m.updates_right_array.Count() > 20 |
|
| 133 |
+ while m.updates_right_array.Count() > m.rightLineCount - 1 |
|
| 117 | 134 |
m.updates_right_array.Shift() |
| 118 | 135 |
end while |
| 119 | 136 |
m.updates_right_array.Push(m.testTask.updateText) |
| 120 |
- m.updates_right.text = m.updates_right_array.Join(chr(10)) |
|
| 137 |
+ ' Jump visible window to bottom |
|
| 138 |
+ m.rightTopVisibleLine = m.updates_right_array.Count() - m.rightVisibleLines |
|
| 139 |
+ if m.rightTopVisibleLine < 0 then |
|
| 140 |
+ m.rightTopVisibleLine = 0 |
|
| 141 |
+ end if |
|
| 142 |
+ showTextRight() |
|
| 121 | 143 |
print m.testTask.updateText |
| 122 | 144 |
' m.logger.logConsole("right", [m.testTask.updateText])
|
| 123 | 145 |
end function |
| ... | ... |
@@ -130,36 +152,41 @@ function onKeyEvent(key as String, press as Boolean) as Boolean |
| 130 | 152 |
handled = false |
| 131 | 153 |
else |
| 132 | 154 |
update_ui = false |
| 133 |
- if key = "OK" and (m.focus_rect = 1 or m.focus_rect = 2) |
|
| 155 |
+ if key = "OK" and m.focus_rect = 1 |
|
| 134 | 156 |
m.testTask.control = "RUN" |
| 135 | 157 |
elseif key = "up" |
| 136 |
- if m.focus_rect = 2: |
|
| 137 |
- m.focus_rect = 1 |
|
| 138 |
- elseif m.focus_rect = 3 |
|
| 158 |
+ if m.focus_rect = 3 |
|
| 139 | 159 |
m.focus_rect = 0 |
| 140 | 160 |
update_ui = true |
| 161 |
+ elseif m.focus_rect = 1 |
|
| 162 |
+ if m.rightTopVisibleLine > 0 |
|
| 163 |
+ m.rightTopVisibleLine = m.rightTopVisibleLine - 1 |
|
| 164 |
+ showTextRight() |
|
| 165 |
+ endif |
|
| 141 | 166 |
endif |
| 142 | 167 |
elseif key = "right" |
| 143 |
- if m.focus_rect = 0: |
|
| 168 |
+ if m.focus_rect = 0 |
|
| 169 |
+ m.prevLeftFocus = 0 |
|
| 144 | 170 |
m.focus_rect = 1 |
| 145 | 171 |
update_ui = true |
| 146 | 172 |
elseif m.focus_rect = 3 |
| 147 |
- m.focus_rect = 2 |
|
| 173 |
+ m.prevLeftFocus = 3 |
|
| 174 |
+ m.focus_rect = 1 |
|
| 148 | 175 |
update_ui = true |
| 149 | 176 |
endif |
| 150 | 177 |
elseif key = "down" |
| 151 |
- if m.focus_rect = 0: |
|
| 178 |
+ if m.focus_rect = 0 |
|
| 152 | 179 |
m.focus_rect = 3 |
| 153 | 180 |
update_ui = true |
| 154 | 181 |
elseif m.focus_rect = 1 |
| 155 |
- m.focus_rect = 2 |
|
| 182 |
+ if m.rightTopVisibleLine < m.updates_right_array.Count() - 1 |
|
| 183 |
+ m.rightTopVisibleLine = m.rightTopVisibleLine + 1 |
|
| 184 |
+ showTextRight() |
|
| 185 |
+ endif |
|
| 156 | 186 |
endif |
| 157 | 187 |
elseif key = "left" |
| 158 | 188 |
if m.focus_rect = 1: |
| 159 |
- m.focus_rect = 0 |
|
| 160 |
- update_ui = true |
|
| 161 |
- elseif m.focus_rect = 2 |
|
| 162 |
- m.focus_rect = 3 |
|
| 189 |
+ m.focus_rect = m.prevLeftFocus |
|
| 163 | 190 |
update_ui = true |
| 164 | 191 |
endif |
| 165 | 192 |
end if |
| ... | ... |
@@ -34,6 +34,14 @@ function executeTest() as void |
| 34 | 34 |
' This task gets run one at the start, and then |
| 35 | 35 |
' again every time the OK button is pressed. |
| 36 | 36 |
|
| 37 |
+ deviceInfo = CreateObject("roDeviceInfo")
|
|
| 38 |
+ aaConnectionInfo = deviceInfo.GetDisplayProperties() |
|
| 39 |
+ m.top.updateText = "roDeviceInfo.GetDisplayProperties" |
|
| 40 |
+ for each key in aaConnectionInfo.Keys() |
|
| 41 |
+ val = aaConnectionInfo[key] |
|
| 42 |
+ m.top.updateText = " " + key + " = " + val.ToStr() |
|
| 43 |
+ end for |
|
| 44 |
+ |
|
| 37 | 45 |
deviceInfo = CreateObject("roDeviceInfo")
|
| 38 | 46 |
aaConnectionInfo = deviceInfo.GetConnectionInfo() |
| 39 | 47 |
m.top.updateText = "roDeviceInfo.GetConnectionInfo" |