Currently in nsDialogs.nsh there is no function to Insert a string into a listbox. The only option is to add a string after the last entry.
Following could be included in nsDialgs.nsh to insert a string at the beginning of the list.
!macro _NSD_LB_InsertString CONTROL STRING
SendMessage ${CONTROL} ${LB_INSERTSTRING} 0 `STR:${STRING}`
!macroend
!define NSD_LB_InsertString "!insertmacro _NSD_LB_InsertString"
Regards
Scott
Diff:
IMHO, the syntax is more than confusing. Neither "insert" nor "add" communicate the position where a string is added (uhm, or inserted). Using NSDLBAppendString / NSDLBPrependString would be distinct (and there could be a temporary alias for the existing NSDLBAddString macro)
AddString is AddString because that is a different message in Windows and the new string is inserted at the end and the list is sorted if LBS_SORT is set. Insert inserts at a specific index and you must specify where because I did not hardcode 0 when I merged this patch. If anything, we can add aliases for Prepend/Append.
With an index specified, "insert" makes sense
Thanks idleberg.
I agree, an index does make much more sense for an Insert.
Regards
Scott