Forum Discussion

Gradnok's avatar
Gradnok
New Contributor
8 years ago

Testcomplete 12 TcxListBox Selection at Runtime from Code not working

Hi,

 

we faced a problem with JavaScript convertions from JScript in Testcomplete (12.20.935.7).

The following code runs fine in JScript . After switching to JavaScript the program raises an error when setting  the selection of an item.

for (zaehler = 0; zaehler < anzahl; zaehler++) {
    testItemName = Trim (UserForms.ScriptRunner.listBoxTestfolge.Items.Items (zaehler).replace (/\[.*\]/, ''));
    if (Project.Variables.testSelection.indexOf (';' + testItemName + ';') != -1) {
      UserForms.ScriptRunner.listBoxTestfolge.Selected(zaehler) = 1;
    } else {
      UserForms.ScriptRunner.listBoxTestfolge.Selected(zaehler) = 0;
    }
  }

The message is: "Invalid left-hand side in assignment"

 

"

 

The documentation (https://support.smartbear.com/testcomplete/docs/reference/user-forms/properties/selected.html) describes how to set the selection of an item in a txclistbox. That is what we want to do.

 

best regards

Andreas Zander