Dlog-Pulldown menu contains string

From Vectorlab

Jump to: navigation, search


Function to check if a certain string is contained in a pulldown menu. Returns the index of the string choice, or -1. By Orso B. Schmid


{ Orso B. Schmid ************************************************ }
{ checks IF a string is in a pull-down menu, returns the index or -1 }
FUNCTION D_StringIsInPull(searchStr: STRING; pullID: LONGINT): INTEGER;
    VAR
        i, cnt : INTEGER;
        choiceStr : STRING;
        
    BEGIN
        D_StringIsInPull := -1;
        
        cnt := NumChoices(pullID);
        i := 0;
        WHILE (i < cnt) & (D_StringIsInPull = -1) DO BEGIN
            GetChoiceStr(pullID, i, choiceStr);
            IF choiceStr = searchStr THEN
                D_StringIsInPull := i;
                
            i := i +1;
        END;
    END;
Personal tools