G4P question

DDJDDJ
edited December 2015 in Library Questions

@Quark

Hi,

I have a drop list but once I have selected a value it doesn't display in the drop list box. I get the value like this:

intListIndex = lboxLine.getSelectedIndex()-1;

Then I try to set the selected value like this:

lboxLine.setSelected(lboxLine.getSelectedIndex());

Can you advise please how to make the drop list show the value that has previously been selected?

Tagged:

Answers

  • Why the '-1' in the first statement?

  • The first option in the drop down is "Select One" and the others are the options. Therefore to get the real number I take the selected item and deduct one.

  • edited December 2015

    The droplist index goes from 0 (zero) to list_size -1 so I suspect you mean +1

    lboxLine.setSelected(lboxLine.getSelectedIndex());

    This will take the current index as an integer and look for a list value which is of type String. So if the current index is 2 it will look for a list value "2" which is probably not there.

Sign In or Register to comment.