hexagon logo

IF_GOTO/C1.INPUT and multiple languages...

OK, I'm stumped (not really, but I would like a general solution).

If I have an IF_GOTO/C1.INPUT == "YES" in my program, it will break when I change PC-DMIS to Swedish.

So, I can write IF_GOTO/(C1.INPUT == "YES") or (C1.INPUT == "JA") to make it work in English and Swedish (and some more, like German).

But how do I write to have it work in the current language PC-DMIS is set to, whatever language that is?

In the Report Editor there's a function LOADSTR(xyz) which can get the current translation of string #xyz, but that doesn't work in a part program.
Parents
  • Well, the LOADSTR() function already exists, but it only works in the Report Editor - why not just make that one available in part programs too, and document the most important numbers?

    Quoting the Help:

    Loading Strings from PC-DMIS

    Similar to how you can change the text color for a cell in the "Changing Expression Text Color" topic, the Reporting expression language lets you pull strings from PC-DMIS's current running language by using this expression:

    =LOADSTR(<integer expression>Wink

    This function takes a single parameter, an integer number that corresponds to the value of a string located in resource.dll or strings.dll.

    A positive number pulls the string from the resource.dll file.

    A negative number pulls the string from the strings.dll file.

    If you type this function in the Cell Expression box (or cell) of the GridControlObject, click OK, and then click outside of the object. PC-DMIS evaluates the expression and returns the string assigned to the specified integer value.





    As a sidetrack, I found this [very] hackish solution, which relies on the two words "YES" and "NO" existing in the right place in the COMMENT/YESNO command (FULL_SCREEN=NO, AUTO-CONTINUE=YES):

    C1         =COMMENT/YESNO,NO,FULL SCREEN=NO,AUTO-CONTINUE=YES,TIME DELAY=0,
                Svara JA eller NEJ!
                IF_GOTO/C1.INPUT==GETTEXT(185, 0, {C1}),GOTO = SVAR_NEJ
                IF_GOTO/C1.INPUT==GETTEXT(450, 0, {C1}),GOTO = SVAR_JA
                COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,
                Du svarade något annat än "JA" eller "NEJ"
                GOTO/****
    SVAR_JA    =LABEL/
                COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,
                Du svarade "JA"
                GOTO/****
    SVAR_NEJ   =LABEL/
                COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,
                Du svarade "NEJ"
                GOTO/****
    ****       =LABEL/
Reply
  • Well, the LOADSTR() function already exists, but it only works in the Report Editor - why not just make that one available in part programs too, and document the most important numbers?

    Quoting the Help:

    Loading Strings from PC-DMIS

    Similar to how you can change the text color for a cell in the "Changing Expression Text Color" topic, the Reporting expression language lets you pull strings from PC-DMIS's current running language by using this expression:

    =LOADSTR(<integer expression>Wink

    This function takes a single parameter, an integer number that corresponds to the value of a string located in resource.dll or strings.dll.

    A positive number pulls the string from the resource.dll file.

    A negative number pulls the string from the strings.dll file.

    If you type this function in the Cell Expression box (or cell) of the GridControlObject, click OK, and then click outside of the object. PC-DMIS evaluates the expression and returns the string assigned to the specified integer value.





    As a sidetrack, I found this [very] hackish solution, which relies on the two words "YES" and "NO" existing in the right place in the COMMENT/YESNO command (FULL_SCREEN=NO, AUTO-CONTINUE=YES):

    C1         =COMMENT/YESNO,NO,FULL SCREEN=NO,AUTO-CONTINUE=YES,TIME DELAY=0,
                Svara JA eller NEJ!
                IF_GOTO/C1.INPUT==GETTEXT(185, 0, {C1}),GOTO = SVAR_NEJ
                IF_GOTO/C1.INPUT==GETTEXT(450, 0, {C1}),GOTO = SVAR_JA
                COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,
                Du svarade något annat än "JA" eller "NEJ"
                GOTO/****
    SVAR_JA    =LABEL/
                COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,
                Du svarade "JA"
                GOTO/****
    SVAR_NEJ   =LABEL/
                COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,
                Du svarade "NEJ"
                GOTO/****
    ****       =LABEL/
Children
No Data