Archive: ListBox ListItems State No PreSelect


ListBox ListItems State No PreSelect
I have a list box that I create on-the-fly for a custom page. For several reasons it would be great if I could have a default selection of the items:

1. I load this list box with potentially hundreds of items. For 99% of the people that will use the app, they'll only care about a couple of the items and won't want to have to dig to find them. Sure I could presort the list with the normal ones at the top but...

2. Because of the method I have to use to harvest the list, it takes a while to display the listboxes and impatient users will click next before they even see that listboxes are there.

3. Some people won't know what the options really are and I would like to preselect the safe/normal items for them.

Please consider adding this to the que or telling me why my idea is flawed. Thanks.


I don't understand you. in the subject you say: "No PreSelect" but in the body you say that you want to preselect.

In case you want to preselect (I asume you are talking of InstallOptions) you can add a "State=selected-item-you-want" in the ini. Is that enough?


Sorry for the Confusion
After reading your answer I went back and tested my code some more it seems you are correct. The problem was that I have multiple ListItems with the same name. Only in the case of a unique name will it select something preloaded in the state field. Makes sense to me, it just so happens that all of the "normal" vaules that are in my list that I wanted to preselect all have duplicates also (Only those have duplicates in fact). Sorry for wasting your time, I spent a lot of time testing this but I never even considered the duplicate bit. Thanks for the help.

Example of problem:
[Field X]
Type=ListBox
Left=0
Right=140
Top=11
Bottom=100
Flags=MultiSelect|EXTENDEDSELCT
ListItems=--Nomral--|Jane|Gina|--Everyone--|Jane|Gina|Beth
State=Jane|Gina

The result is nothing shows up selected


You aren't using it right.

[Field X]
Type=ListBox
Left=0
Right=140
Top=11
Bottom=100
Flags=MultiSelect|EXTENDEDSELCT
ListItems=--Nomral--|Jane|Gina|--Everyone--|Jane|Gina|Beth
State=Jane


You had Jane and Gina to be readily selected, but of course, how can you have 2 selected?
You can't.

Edit:
Ok with multiselect on, then you should be able to.
Is this a bug?

-Stu


Status now is that I can do it. I don't know if someone fixed it or not, I just downloaded the latest CVS I may have been using an old version, but now it selects the first instance of that name in the list even when there are duplicates.


There were some code changes to this part since b3. It's possible one of the fixes was this.