Library TextListUtils 3.5.16.0, function GetTextListInfo

kislov
2020-05-21
6 days ago
  • kislov

    kislov - 2020-05-21

    Hi.
    Maybe someone have code snippet for function GetTextListInfo from library TextListUtils 3.5.16.0?
    I want to get number of entries in my textlist and get ID for each of them with IEC-code.

    I will be really appreciated for any help.

     
  • m.prestel

    m.prestel - 6 days ago

    Hello @kislov,

    PROGRAM PLC_PRG
    VAR
        itfTextListInfo : TLU.ITextListInfo;
        udiNum : UDINT;
        iterator : COL.IIterator;
        itfElem : COL.IElement;
        itfStringElem : COL.IStringElement;
        wst : STRING;
        sTextListName, stText : STRING;
        xRead : BOOL;
    END_VAR
    IF xRead THEN
        xRead := FALSE;
        itfTextListInfo := TLU.GetTextListInfo(stTextListName:=sTextListName);
        IF itfTextListInfo <> 0 THEN
            udiNum := itfTextListInfo.NumberOfEntries;
            iterator := itfTextListInfo.GetIdIterator();
            IF iterator <> 0 THEN
                WHILE iterator.HasNext() DO
                    iterator.Next(itfElement=>itfElem);
                    __QUERYINTERFACE(itfElem, itfStringElem);
                    wst := itfStringElem.StringValue;
                    sTextListName := itfTextListInfo.Name;
                    TLU.GetText(sTextList:=sTextListName, sTextIndex:=wst, psText:=ADR(stText), diSize:=SIZEOF(stText));
                END_WHILE
            END_IF
            itfTextListInfo.Release();
        END_IF
    END_IF
    

    Best regards,
    Marcel

     
  • kislov

    kislov - 6 days ago

    Thank you very much, sir Marcel!

     

    Last edit: kislov 6 days ago

Log in to post a comment.