Hi,
I need to attach an id to every item in a droplist.
The droplist has a few items: "item1", "item2", "item3" etc.
The user selected item of the droplist is for example: "item1" which corresponds to number 435 "Item 2" corresponds to number 256, "item3" has number 92 etc.
1) How can I assign a number to a droplist item?
2) Is it possible to get the itemindex of the selection droplist?
Regards! 😛
Another droplist question
2 posts
IO doesn't offer such a feature so you will have to compare the State value to every possible item and assign a number to a variable according to it.
For example:
For example:
ReadIniStr $0 file.ini "field 6" state
StrCmp $0 "item 1" 0 +3
StrCpy $1 435
Goto done
StrCmp $0 "item 2" 0 +3
StrCpy $1 256
Goto done
# ...
done: An easier way of doing it will be defining a macro:!macro ITEM_TO_NUMBER item number
StrCmp $0 "${item}" 0 +3
StrCpy $1 ${number}
Goto done
!macroend
ReadIniStr $0 file.ini "field 6" state
!insertmacro ITEM_TO_NUMBER "item 1" 256
!insertmacro ITEM_TO_NUMBER "item 2" 543
!insertmacro ITEM_TO_NUMBER "item 3" 656
# ...
done: