258 | | Some especially older apps may use other styles of forms such as !DynamicForm which is a C++ style of form defined in the older lib825 instead of lib825ev. Apps may also use FormLCD which defines forms based on structs. Updating these apps will require more effort to convert them to use the newer FORM_INIT ... approach. |
259 | | |
| 258 | Some apps, especially older ones may use lib825 instead of the newer lib825ev. In addition to CForm (FORM_INIT) a different method of creating forms exists in the older lib825 called !DynamicForm. These apps may also use a C++ class called the Application class. To update apps using lib825 to new style graphics it would be best to convert the app to use lib825ev (event style) apps first. Depending on the size of the app this could be a much more involved process. |
| 259 | |
| 260 | Apps using lib825 or lib825ev may also use FormLCD which defines forms based on structs. It is relatively simple to convert these apps to CForm (FORM_INIT) style, but will still take more time. Refer to the example below: |
| 261 | |
| 262 | {{{ |
| 263 | #define nTimeItems 3 |
| 264 | const struct form_item_struct frmtm[nTimeItems] = { |
| 265 | { |
| 266 | // X Y Prompt Len Min Max Flag Choices Help |
| 267 | { 0, 3, "Hour: ", 2, 0, 23, FORM_UINT8, NULL, "Enter the hour in 24 hour time\r3 p.m. = 15" }, |
| 268 | { 0, 5, "Minute: ", 2, 0, 59, FORM_UINT8, NULL, "Enter the minutes" }, |
| 269 | { 0, 7, "Second" ", 2, 0, 59, FORM_UINT8, NULL, "Enter the seconds" } |
| 270 | }; |
| 271 | |
| 272 | int SetTime(void) |
| 273 | { |
| 274 | int n; |
| 275 | void* pData[nTimeItems]; |
| 276 | |
| 277 | pData[0] = &g_datetime.hour; |
| 278 | pData[1] = &g_datetime.minute; |
| 279 | pData[2] = &g_datetime.second; |
| 280 | |
| 281 | ClearLCD(); |
| 282 | SetCurColor(COLOR_INFO); |
| 283 | PrintLCD("Set Time"); |
| 284 | |
| 285 | SetCurColor(nColorGreen); |
| 286 | n = FormLCD((struct form_item_struct*)frmtm, pData, nTimeItems, NULL, nFormFlgShowHelp); |
| 287 | if(n) { |
| 288 | // Set the time |
| 289 | // ... |
| 290 | } |
| 291 | return n; |
| 292 | } |
| 293 | }}} |
| 294 | |