2

I intend to create a dialog box by using a Window object (class Window extends QWidget).

The dialog box containing these elements:

  • a listbox (ListBox1)
  • 2 labels (Label1 & Label2)
  • a button

The onClick() function for the list box:

function ListBox1Click($sender, $params)
{
   $selected = $this->ListBox1->readItemIndex();
   $this->Label1->setCaption($selected); 
}

The purpose of this code is to select an item from the listbox, then display (ListBox1Click) it's index on Label1.

However, when an item is selected, readItemIndex() returns numerical value `-1.

Items contained in ListBox1

(Key / Value)
32432 / dfdfwsf
43543 / csdcsdc

For instance, if I select dfdfwsf from the listbox, it should have return the index/key 32432; instead, -1 is returned.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.