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

Retrieving text from TextList.

XopHeT
2014-11-13
2018-02-21
  • XopHeT - 2014-11-13

    Hello!
    Does anybody have an IDEA how could I retrieve text from TextList in my programm?
    I have a list, for example:
    0:a
    2:b
    54:c

    i saw function DynamicTextGetText, but I have no idea how to use it. It always returns '';
    Thank you!

     
  • XopHeT - 2014-11-18

    up

     
  • TimvH

    TimvH - 2014-11-18

    It returns nothing if no language has been selected yet.
    If you want to get the "default" text, then use:

    VisuElems.cmpDynamictext.DynamicTextGetDefaultText(ADR(sTextList), ADR(sTextListID))^
    

    If the user has selected a language, or if this is set in the application you can use:

    VisuElems.cmpDynamictext.DynamicTextGetText(ADR(sTextList), ADR(sTextListID))^
    

    What you can do is remember the latest selected language and load that at the start of the application.

    // At start-up: initialise the actual language with the last selected language
    IF xInit THEN
    Β  Β visuElems.CURRENTLANGUAGE := gvlPersistent.sSelectedLanguage;
    Β  Β xInit := FALSE;
    END_IF
    // Remember the selected language (if it is changed it needs to be activated again during start-up)
    gvlPersistent.sSelectedLanguage := visuElems.CURRENTLANGUAGE;
    
     
  • XopHeT - 2014-12-02

    Thank you for your response!

     
  • Anonymous - 2015-11-11

    Originally created by: IC_Holtec

    Does somebody have an programing example, how to use DynamicTextGetText, because it dont Work for me.

     
  • lst-tech - 2018-02-16

    Does anybody know, if it's possible to retrieve Text from enums with textlist Support? The data is also saved as .txt file, but in UTF-8 which doesn't work with "DynamicTextGetText" etc..

     
  • e.kislov - 2018-02-17

    lst_tech hat geschrieben:
    Does anybody know, if it's possible to retrieve Text from enums with textlist Support? The data is also saved as .txt file, but in UTF-8 which doesn't work with "DynamicTextGetText" etc..

    Did you try to use "DynamicTextGetTextW"?

     
  • lst-tech - 2018-02-21

    Yes, I tried this one. The Problem is, that the file coding differs from "normal" text list (utf-8 / ANSI).
    It seems that UTF-8 isn't working with DynamicTextGet... My solution is to read it manually with FileOpen/FileGets (According to the CSV reader example).

    Thanks for your support

     

Log in to post a comment.