Skip to content
⌘ NSIS Forum Archive

Changing values of fields in custom dialogs

5 posts

tderouin#

Changing values of fields in custom dialogs

I'm attempting to implement a custom dialog using an INI file and want to change the value of one of the fields, a label, dynamically when the page is loaded, but WriteINIStr doesn't seem to do the trick:

Function customReadyPage
         !insertmacro MUI_HEADER_TEXT $(INSTALL_READY_TITLE) $(INSTALL_READY_SUBTITLE)
         WriteINIStr ready.ini "Field 2" "Text" "new value"
         !insertmacro MUI_INSTALLOPTIONS_DISPLAY "ready.ini"
FunctionEnd 
But the value of Field 2 is what's specified in ready.ini when the page loads.

Any suggestions?
kichik#
What was wrong with the original script is that you used:

WriteINIStr ready.ini "Field 2" "Text" "new value"

Instead of:

WriteINIStr $PLUGINSDIR\ready.ini "Field 2" "Text" "new value"

NSIS can't know where the file is located if you don't tell it.
tderouin#
Ok, good to know.

What about this problem?
LangString INSTALL_READY_DEST_DIR ${LANG_ENGLISH}                     "dir:"
...
WriteINIStr $PLUGINSDIR\ready.ini "Field 2" "Text" "$(INSTALL_READY_DEST_DIR) test" 
Only shows up "dir:", even though there's plenty of room in the label. Any ideas?
kichik#
You can only use a LangString on its own. You can't put it in other strings. I have updated the docs.