Change Menu Text with a parameter

The menu is defined in menulang.h
I want to change the text with a parameter.
eg
if (a)
{#define UI_TEXT_PRINT_TIME_DE            "XX";}
else
{#define UI_TEXT_PRINT_TIME_DE            "YY";}
the #define is a definition for the compiler - I am not familiar with it.
Is there a trick?

Comments

  • The text is defined on compile time. You can not change it at runtime if that is what you want. Th eonly way to insert runtime values is like we do with the %xx placeholders which get replaced in a function in ui.cpp.
  • Thanks for the hint! That opens a door.
    eg I want to misuse %do as a placeholder. How can I import another text?
    ...
            case 'd':  // debug boolean
                //original if (c2 == 'o') addStringOnOff(Printer::debugEcho());
                if (c2 == 'o') addStringOnOff("tt");
    ..
    That is not working, "An" is added in the text
    #define UI_TEXT_PRINT_TIME_DE            "         %do"



  • Yes An is correct. addStringOnOff will add An/Aus depending on value. What you want to call is addString with a string as parameter. YOu can also make your own codes if you use a letter that is currently unused.
  • Thanks for the hint!
    I added %P1,%P2,.. as placeholders.
    works fine with addStringP!
    Thanks again.
Sign In or Register to comment.