Old 8th October 2013, 09:21   #1
tillz1505
Junior Member
 
Join Date: Oct 2013
Posts: 2
nsArray loop Counter? or any loop counter at all?

Hi guys, I've been using NSIS for a about a week now but I seem to have come across a problem:

Basically, I currently have an array (using nsArray) with some key/values e.g.


code:

nsArray::SetList MyArray1 /key=key1 "val 1" /key=key2"some val 2" /key=key5949 "another value" etc



Then I would do something like this to foreach through it and apply each value to an nsDialog dropdownlist:

code:

${ForEachIn} MyArray1 $R0 $R1
${NSD_CB_AddString} $DropDownList"$R1"
${Next}



My problem is, I want to then use:

code:

SendMessage $DropDownList${CB_SETITEMDATA} $drop_list_index $itemdatavalue



in the foreach loop and have each drop list have their own itemdatavalue related to the key in the array, but I also need to have an indexer of some sort so i can apply each itemdatavalue accordingly.

I am really struggling on thinking of a way of accomplishing this, and I have even looked at using the loglib 'for' loop, but I wasn't having much luck.

Any help would be greatly appreciated.
tillz1505 is offline   Reply With Quote
Old 8th October 2013, 10:54   #2
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
code:
StrCpy $R2 0
${ForEachIn} MyArray1 $R0 $R1
${NSD_CB_AddString} $DropDownList "$R1"
SendMessage $DropDownList ${CB_SETITEMDATA} $R2 $itemdatavalue
IntOp $R2 $R2 + 1
${Next}

Stu
Afrow UK is offline   Reply With Quote
Old 8th October 2013, 11:03   #3
tillz1505
Junior Member
 
Join Date: Oct 2013
Posts: 2
wow, thank you so much Stu, it worked perfectly! yay
tillz1505 is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Tags
counter, itteration, loop, nsarray

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump