Changes between Version 73 and Version 74 of Docs/825gen2/Dev/UpdatingLegacyAppsToNewLook


Ignore:
Timestamp:
07/09/25 13:33:10 (2 weeks ago)
Author:
Don Wilson
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Docs/825gen2/Dev/UpdatingLegacyAppsToNewLook

    v73 v74  
    239239#if ARM64
    240240        InitLCD(DSP_INIT_NEW_STYLE_APP);
    241 
    242         dspMain.SetZoomWidth(0, dspMain.GetZoomWidth(1));
    243         if(dsp_height > 800) {
    244                 dspMain.SetZoomHeight(0, (int)(dspMain.GetZoomHeight(1) * 0.84));
    245         }
    246 
     241        AppDisplayZoomInit();
    247242        InitFonts();
    248 
    249243        weightScreen.SetupDisplayLocations();
    250 
     244        EnableFullScreenMode();
    251245#else
    252246        InitLCD();
     
    255249}
    256250}}}
     251The EnableFullScreenMode() is optional but recommended for most new apps. However, this will require a little more work to make the app fully functional.
    257252
    25825310. Modify all the references to the Show//XXXX// show as ShowGTN() to add the weightScreen instance such as:
     
    26526012. Search for all menu and inputs forms such as search for "FORM_INIT" make appropriate changes to use new style FORM_ADD_INPUT2 instead of FORM_ADD_INPUT and FORM_ADD_BUTTON2 instead of FORM_ADD_BUTTON such as:
    266261
     262Following is an example input form if EnableFullScreenMode is not used.
    267263{{{#!c++
    268264void PresetScreen(void)
     
    297293In the above example notice after FORM_INIT the function !SetupInputFormToUseFontSet is called. !SetupInputFormToUseFontSet is a helper function defined in apphelpers.cpp. This gives the form a pointer to the fonts that were initialized previously. The function also sets the starting positions of the rect, and rectInp rectangles that are used to define where to show the prompts and input fields. The final parameter is a string used to determine the width of the prompts. This should be the longest prompt text in the form. The !AdvanceInputRects function call is used between FORM_ADD_INPUT2 calls to move the rect and rectInp down an appropriate amount for the next input.
    298294
     295Following is an example input form when EnableFullScreenMode is used.
     296
     297{{{#!c++
     298void PresetScreen(void)
     299{
     300#if ARM64
     301        CFormRect rectInpBtn;
     302        CFormButton btnOk;
     303
     304        FORM_INIT(Setup, EventPresetScreenShow, NULL, NULL, NULL, nFormFlgShowHelp | nFormFlgAutoPresentPopup | nFormFlgShowPopupTabKeypad);
     305
     306        SetupInputFormToUseFontSet(formSetup, rectInpBtn, 0.45, 1.3);
     307
     308        FORM_ADD_INPUT2(Setup, Thresh,  rectInpBtn, rectKeypad, "On Threshold: ", 6, 0, 999999, NULL, &g_setup.onThresh, FORM_FLOAT, NULL, "Enter the on threshold");
     309        rectInpBtn += inputAdvanceY;
     310        FORM_ADD_INPUT2(Setup, ViolTot, rectInpBtn, rectKeypad, "Total Violation: ", 6, 0, 999999, NULL, &g_setup.violWt[0], FORM_FLOAT, NULL, "Enter violation weight for total");
     311        rectInpBtn += inputAdvanceY;
     312        FORM_ADD_INPUT2(Setup, Viol1,   rectInpBtn, rectKeypad, "P1 Violation: ", 6, 0, 999999, NULL, &g_setup.violWt[1], FORM_FLOAT, NULL, "Violation weight for P1");
     313
     314        formSetup.LeftAlignPromptInputs(inpThres, inpViol1);
     315
     316        AddFormOkButton(formSetup, btnOk);
     317#else
     318        FORM_INIT(Setup, EventPresetScreenShow, NULL, NULL, NULL, nFormFlgShowHelp);
     319        FORM_ADD_INPUT(Setup, Thresh, 0, FONT_HEIGHT * 2, "On Threshold: ", 6, 0, 999999, NULL, &g_setup.onThresh, FORM_FLOAT, NULL, "Enter the on threshold");
     320        FORM_ADD_INPUT(Setup, ViolTot, 0, FONT_HEIGHT * 4, "Total violation: ", 6, 0, 999999, NULL, &g_setup.violWt[0], FORM_FLOAT, NULL, "Enter violation weight for total");
     321        FORM_ADD_INPUT(Setup, Viol1, 0, FONT_HEIGHT * 6, "P1 Violation: ", 6, 0, 999999, NULL, &g_setup.violWt[1], FORM_FLOAT, NULL, "Violation weight for P1");
     322#endif
     323        FORM_SHOW(Setup);
     324        int n = FORM_RUN(Setup);
     325        if (n != FORM_RESULT_ESC) {
     326                SaveSetup();
     327        }
     328        FORM_HIDE(Setup);
     329}
     330}}}
     331
     332In the above example FORM_INIT has additional flags //nFormFlgAutoPresentPopup | nFormFlgShowPopupTabKeypad//. This is to show the popup keypad automatically and include the tab keypad. The function !SetupInputFormToUseFontSet is called. !SetupInputFormToUseFontSet is a helper function defined in apphelpers.cpp. This gives the form a pointer to the fonts that were initialized previously. The function also sets the starting positions of the rect, and rectInp rectangles that are used to define where to show the prompts and input fields. The final parameter is a string used to determine the width of the prompts. This should be the longest prompt text in the form. The !AdvanceInputRects function call is used between FORM_ADD_INPUT2 calls to move the rect and rectInp down an appropriate amount for the next input.
     333
     334
    299335{{{#!c++
    300336EVENT(FileOperationShow)