Archive: InstallOptions checkbox state determined at runtime


InstallOptions checkbox state determined at runtime
Hello

In uninstall section I added a custom dialog that contains checkbox with section desired to uninstall. I want to disable some of checkbox corresponding to not installed kits.

How did I tried to do this:

I had an uninstall function,
un.hello that is the creation function for the custom page.

!insertmacro MUI_HEADER_TEXT "$(un.TEXT_IO_TITLE)" "$(un.TEXT_IO_SUBTITLE)"
!insertmacro MUI_INSTALLOPTIONS_INITDIALOG "ioFile.ini"
;Check if JDK installed -----------------------
....
;If not installed enable the checkbox (initial Flags=DISABLED for all checkbox)
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioFile.ini" "Field 8" "Flags" ""

The problem is that all the checkbox remain disabled, as default.


Questions:
1. Could I dinamically change the INI file? How?
2. I also tried to use:
GetDlgItem $R9 $R8 1208 ;1200 + Field number - 1

;$R9 contains the HWND of the first field
SendMessage $R9 ${BM_SETCHECK} "1" 0

That menas to send the message BM_SETCHECK to check box to enable it,
but this message is not present in WinMessages.nsh. The message has the 0xF1 value, so I tried with
SendMessage $R9 "241" "1" 0,
but no result. Any idea?

Thanx,
H


If I click the back button and next then, the checkbox appear enabled.
I tried to put the code that enables the checkbox on un.onInint after
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "ioFile.ini" but it did not worked.

A rough solution might be to insert a custom dialog a very short period of time, to write in INI and then display mypage. This is not very nice. Any other idea?

H


You need to write to the ini file before the IO page shows. You are currently writing to it after the user leaves the page.

-Stu


That is the point! I have a custom page
UninstPage custom un.Hello un.leaveComponents
The creation function is un.Hello, I added the ioFile.ini with ReserveFile to the kit. The file is extracted in
un.onInit (!insertmacro MUI_INSTALLOPTIONS_EXTRACT "ioFile.ini" )
and in un.hello (the creation function of the page) I wrote:

!insertmacro MUI_HEADER_TEXT "$(un.TEXT_IO_TITLE)" "$(un.TEXT_IO_SUBTITLE)"
!insertmacro MUI_INSTALLOPTIONS_INITDIALOG "ioFile.ini"
.....

!insertmacro MUI_INSTALLOPTIONS_WRITE "ioFile.ini" "Field 8" "Flags" " "
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioFile.ini" "Field 13" "Flags" " "
.....

!insertmacro MUI_INSTALLOPTIONS_SHOW

But nothing happens. As I said, inside the same
!insertmacro MUI_INSTALLOPTIONS_INITDIALOG "ioFile.ini"
!insertmacro MUI_INSTALLOPTIONS_SHOW
pair, I treieed to send a message BM_SETCHECK (0xF1) with
WPARAM=BST_CHECKED (0x1) and then a WM_PAINT message to the parent window, but apparently it dosen't worked.

Thank you for your response.
Other ideas?:)

H


You need to write to the INI file before the InstallOptions dialog initializes (before !insertmacro MUI_INSTALLOPTIONS_INITDIALOG "ioFile.ini").


OK! It worked. I believed that the role of
!insertmacro MUI_INSTALLOPTIONS_INITDIALOG "ioFile.ini"
.....
!insertmacro MUI_INSTALLOPTIONS_SHOW
was to define the graphical interface.

Anyway it worked, thanx!

H