Archive: InstallOptions Custom Page Write to Field


InstallOptions Custom Page Write to Field
ReadINIStr $0 "$PLUGINSDIR\directoryRequest.ini" "Field 2" "State"

With this piece of code I read the content of a textfield in a custom page. But is there a way to write something in that field???

thx, Lieven cardoen


I tried doing this, but nothing changes in my DirRequest Field

WriteINIStr "$PLUGINSDIR\directoryRequest.ini" "Field 2" "State" $7
IfErrors 0 +2
MessageBox MB_OK "Error writing to ini"
FlushINI "$PLUGINSDIR\directoryRequest.ini"

Also, no error is given.


WriteIniStr "$PLUGINSDIR\directoryRequest.ini" "Field 2" "State" "your record"

Using WriteIniStr you may write/update manually every Ini field.

Check included InstallOptions examples :-)


Thx, but it doesn't seem to work.

What does this code do :

FindWindow $R0 "#32770" "" $HWNDPARENT
GetDlgItem $R1 $R0 1200
SendMessage $R1 ${WM_SETTEXT} 1 "STR:Browse"


Lieven


Setting the text for the specified control (1200), needs !include WinMessages.nsh.

Just try to 'play' a little with IO examples and you'll get 'em all. :-)


Could it be that you need to use Writeinistr before Custom Page is shown?

I need to change the state of DirRequest when Custom Page is shown.

Lieven


Well,

writeinistr does seem to work, because when i do a readinistr right after, the state has changed. But visually nothing changes...


you have to combine notify flag and EnableWindow according on what exactly you wish to figure


It's kind of Chinese to me. I don't understand why writeinistr changes the state, but visually nothing changes...


Included IO examples will make everything clear for you :-)


If I put
WriteINIStr "$PLUGINSDIR\directoryRequest.ini" "Field 2" "State" "Testing"
in the .onInit it does work...


Thx Red Wine for the replies, but I think I'm missing something important.

ps : All these examples you are talking about, where can I find them. In my NSIS folder, there aren't many examples...


Do you need to refresh the page after you do a writeinistr?


Wherever is your NSIS Installation e.g. C:\Program Files\NSIS\Examples\InstallOptions.

There are 4 IO examples, try to 'play' a little with them, the one according to your request is 'testnotify.nsi' :-)


I've looked at it, and it doesn't solve my problem, because in all of the examples a certain value in a ini is set before the custom page is shown.
My problem is that I change a value when custom page is allready shown, and this doesn't seem to work...

Lieven


Ok, i found it!!!

ReadINIStr $1 "$PLUGINSDIR\directoryRequest.ini" "Field 2" "HWND"
SendMessage $1 ${WM_SETTEXT} 0 "STR:$drive\"

Red Wine, thx for your time!!! Cheers!