Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

VisuElems.cmpDynamictext.DynamicTextGetTextW returns pointer to empty string

ert
2017-12-01
2018-09-18
  • ert - 2017-12-01

    I try to use VisuElems.cmpDynamictext.DynamicTextGetTextW function to read a text from text list.
    In my project I noticed that it returns pointer to "" until I add a Visualization and select a language in the Visualization Manager. Then it works.

    But my problem is I would like to use the function in a library and call it from inside the library.
    The function called from inside a library always returns non-zero pointer.
    I suspect this is because of language (I may be wrong), because for the library no language is selected.
    I tried to set a language with VisuElems.cmpDynamictext.DynamicTextChangeLanguage function, but without success.
    Does anyone have an idea how to resolve it?

     
  • Lo5tNet - 2017-12-01

    From past experience when no "language" is selected I had to call DynamicTextGetDefaultTextW instead of DynamicTextGetTextW.

     
  • ert - 2017-12-04

    Thank you for your reply, Comingback4u.

    I have tried both functions (DynamicTextGetTextW and DynamicTextGetDefaultTextW), but both of them return pointer to an empty string.
    Strangely, I noticed that if I put the text list in my project rather than in the library, then the functions call from the library return correct text.
    I also called VisuElems.CURRENTLANGUAGE and DynamicTextGetCurrentLanguage functions inside the library and they both seem to have a correct language selected (same as in the project).
    So my understanding now is: there is a problem with accessing/receiving the text from the text list from inside the library, because the text list placed in the project works.

    I still do not know how to resolve it though.

     
  • Lo5tNet - 2017-12-04

    I have not tried it in a library but can you check to see if the textlist is being put onto the device? The textlist might be adding the library name before it and can verify that by looking in the visu folder. For example you might need to call "library.txtlistname" instead of just "txtlistname". Just a thought.

     
  • ert - 2017-12-07

    Comingback4u hat geschrieben:
    (...) The textlist might be adding the library name before it and can verify that by looking in the visu folder. For example you might need to call "library.txtlistname" instead of just "txtlistname". Just a thought.

    That was exactly what happened!
    I had to add the library namespace before text list name, as the library adds its prefix with dot.
    That resolved the problem.
    Thank you very much for your support!

     
  • puma80801 - 2018-09-17

    I know, the post is old! But ist there somebody who could tell me what's wrong?

    I want to change the language but i couldn't do it.
    I can see the language (Deutsch, Enlisch,...) i choose with a button in my visu.
    But i can see no text from my textlist.

    Thanks a lot. Greetings Timo

    IMG: Sprachumschaltung.JPG

     
  • e.kislov - 2018-09-18
    1. Use system variable VisuElems.CurrentLanguage to switch language from code (if you need it).
    2. Try other quotes: 'library.Texlist_EBS', '0'
     
  • puma80801 - 2018-09-18

    Thank you very much! The quotes fixed the problem!

     

Log in to post a comment.