- NSIS Discussion
- InstallOptions Custom Page Write to Field
Archive: InstallOptions Custom Page Write to Field
lievencardoen
8th May 2006 09:19 UTC
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
lievencardoen
8th May 2006 09:37 UTC
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.
Red Wine
8th May 2006 09:39 UTC
WriteIniStr "$PLUGINSDIR\directoryRequest.ini" "Field 2" "State" "your record"
Using WriteIniStr you may write/update manually every Ini field.
Check included InstallOptions examples :-)
lievencardoen
8th May 2006 09:42 UTC
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
Red Wine
8th May 2006 09:48 UTC
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. :-)
lievencardoen
8th May 2006 09:49 UTC
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
lievencardoen
8th May 2006 09:53 UTC
Well,
writeinistr does seem to work, because when i do a readinistr right after, the state has changed. But visually nothing changes...
Red Wine
8th May 2006 09:54 UTC
you have to combine notify flag and EnableWindow according on what exactly you wish to figure
lievencardoen
8th May 2006 10:08 UTC
It's kind of Chinese to me. I don't understand why writeinistr changes the state, but visually nothing changes...
Red Wine
8th May 2006 10:15 UTC
Included IO examples will make everything clear for you :-)
lievencardoen
8th May 2006 10:17 UTC
If I put
WriteINIStr "$PLUGINSDIR\directoryRequest.ini" "Field 2" "State" "Testing"
in the .onInit it does work...
lievencardoen
8th May 2006 10:18 UTC
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...
lievencardoen
8th May 2006 10:19 UTC
Do you need to refresh the page after you do a writeinistr?
Red Wine
8th May 2006 10:34 UTC
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' :-)
lievencardoen
8th May 2006 10:39 UTC
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
lievencardoen
8th May 2006 10:47 UTC
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!