Unable to altering a list box
Try as I might I have been unable to update the contents of a list box. I have searched and searched to no avail so any help on this would be appreciated.
I have a list box with some values in it.
When I hit "Go" I want to select that entry in the list box
On reading some external documentation LB_FINDSTRING returns LB_ERR which is not defined anywhere. I have added a bug on SF (1771644) which covers it, but it would be nice to know so that I can include it in my installer before your next release.
Aside from the LB_ERR issue which is almost academic because no matter what I do it never works.
Tried of programming by trail and error. :(
Help !
Cheers,
David.
[Settings]
NumFields=3
[Field 1]
Type=DropList
Left=30
Top=26
Right=-31
Bottom=100
Flags=Notify
State=
ListItems=
[Field 2]
Type=Text
Left=30
Top=94
Right=119
Bottom=114
State=three
[Field 3]
Type=Button
Left=156
Top=89
Right=-5
Bottom=119
Text=Go
Flags=NOTIFY
Name 'ListBoxExample'
>OutFile 'ListBoxExample.exe'
>!include "MUI.nsh"
>!include "WinMessages.nsh"
>;!include LogicLib.nsh
>!define F_SYSTEM__NEXT_ID 0
>!define F_LIST_ID 1
>!define F_LIST "Field ${F_LIST_ID}"
>!define F_TEXT_ID 2
>!define F_TEXT "Field ${F_TEXT_ID}"
>!define F_BUTTON_GO_ID 3
>!define F_BUTTON_GO "Field ${F_BUTTON_GO_ID}"
>Page Custom CustomCreate CustomLeave
>Var text_value
>Var list_hw
Section empty
>SectionEnd
>Function CustomCreate
!insertmacro MUI_HEADER_TEXT "ListBox Example" "Why won't it work?"
!insertmacro MUI_INSTALLOPTIONS_WRITE "ListBoxExample" "${F_LIST}" "ListItems" "one|two|three|four"
!insertmacro MUI_INSTALLOPTIONS_WRITE "ListBoxExample" "${F_TEXT}" "State" "three"
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "ListBoxExample"
>FunctionEnd
>Function CustomLeave
!insertmacro MUI_INSTALLOPTIONS_READ $text_value "ListBoxExample" "${F_TEXT}" "State"
MessageBox MB_OK "text_value=$text_value|"
!insertmacro MUI_INSTALLOPTIONS_READ $list_hw "ListBoxExample" "${F_LIST}" "HWND"
MessageBox MB_OK "list_hw=$list_hw|"
!insertmacro MUI_INSTALLOPTIONS_READ $0 "ListBoxExample" "Settings" "State"
StrCmp $0 ${F_SYSTEM__NEXT_ID} end
StrCmp$0 ${F_BUTTON_GO_ID} go
Abort
go:
# Show in List box
SendMessage $list_hw ${LB_SELECTSTRING} -1 "STR:$text_value" $0 /TIMEOUT=5000
end:
Abort
FunctionEnd
>Function .onInit
!insertmacro MUI_INSTALLOPTIONS_EXTRACT_AS "ListBoxExample.ini" "ListBoxExample"
>FunctionEnd
>