Archive: Disable/enable options in Custom page


Disable/enable options in Custom page
Hi, can't seem to find this on the board so here it goes.

What I'm trying to do is change my options to Enabled in my custom page after the user has choosen from a droplist.

the custom page looks like this

"Select Datastorage type"
Type=droplist
ListItems=CSV|ODBC

When the user selects ODBC I want to enable these boxes

[Field 9]
Type=droplist
ListItems=MSSQL|MySQL
...

[Field 11]
Type=text
Left=0
...

I figured out that I could just load up a new custom page if the user selects ODBC, but this would be nicer :)

So if there are any way to do this please let me know.

thx
ingig


InstallOptions are not dynamic in that changes made by the user on the page are instantly taken.
It is only after the user exists the InstallOptions page that the changes are written to the IO ini file.

The only way to do this would to have 3 seperate IO pages, 1 with your main selection box, then the two others as sub pages which are shown depending on the users' selection.

-Stu


Ok, so when the user selects ODBC you will need to show up a new page afterwards.

Else, skip that page using Abort

-Stu


Ok, thanks for the info.

Do you know if the dynamic thing is planned?

ingig


I'm not sure.
It would be a nice feature though... but a tonne of new code would have to be written!

-Stu


It is easy to make dynamic changes to a custom page using a single INI file if the fields are carefully arranged. When I need to do this in my installers, I make sure that the "dynamic" fields are all at the end of the list of fields - then I can turn these fields on or off simply by changing the NumFields value in the INI file.

Suppose I have a custom page with 10 fields and sometimes I want to hide two of them. First I design the INI file so that these two fields are numbers 9 and 10. The function that displays the custom page is arranged like this skeleton:

Function MyCustomPage

; Hide last two fields
WriteINIStr "$PLUGINSDIR\ioA.ini" "Settings" "NumFields" "8"

loop:
; Display the custom page
InstallOptions::dialog "$PLUGINSDIR\ioA.ini"

; check stuff (eg user data input/selections),
; $R0 set to "no" if the hidden fields are to remain hidden

StrCmp $R0 "no" exit

; Now make the two hidden fields visible and display the modified page

WriteINIStr "$PLUGINSDIR\ioA.ini" "Settings" "NumFields" "10"
Goto loop

exit:
FunctionEnd
This idea can be easily extended to do more than just turn some fields on or off. All you have to do is make the appropriate changes to the custom page's INI file then call InstallOptions::dialog again to display the modified custom page. I have found this a useful way to improve the user interface to my installer.

That's a good idea.
I write DISABLED to my controls if they want to be diabled, or if it is a ListBox (in one case) I changed the control completely to a Text control (because DISABLED doesn't work on ListBox's)

What he wanted was say, you click "use blah" then straight away (without clicking Next) another part would lighten up from being disabled containing options for "blah".

-Stu