View Full Version : Dynamically add checkbox to a dialog at runtime

06-08-2005, 03:43 PM
I want to add checkboxes dynamically to a dialog at runtime. The install discovers the features that need to be installed during runtime and needs to display it to the user. Is it possible to add checkboxes dynamically to a dialog at runtime.
I am using a Basic MSI project, but I am open to anything. Thanks in advance.
Alternatively, I am also Ok to display the CustomSetup dialog as long as I can change the entries dynamically.
I tried setting the DisplayName as [Feature1]
Sometime during the install I had a custom action that set the Session.Property("Feature1") = "This is a test"
No luck. The CustomSetup dialog displays it as [Feature1] (instead of 'This is a test' that I expected)

06-08-2005, 04:15 PM
I too am very interested in this functionality...and have posted this message previously without any comments. I have also entered an IS service request, without any answers, after 1.5 weeks.

06-09-2005, 12:37 AM
I dont think this is possible without creating your own custom dialog outside windows installer.

What you could do is create the dialog boxes, and Hide or Show them depending on the features you are installing.
This can be achieved by using the ControlCondition table, or the 'Condition' tab in the dialogs window inside install shield.

06-09-2005, 01:17 AM
Thanks. Unfortunately our install only discovers the features to be installed during runtime and then displays it to the user.
Basically, we have a folder in the source directory with some msi files. The install loops through the list of msi files and reads the ProductName and displays it to the user. (At this time, I can loop through the folder and read the ProductName of all the msi files. Not sure how to display it). The user can then decide which msi he wants to install. For future releases, we simply plan on adding / updating the msi files in the Source directory folder. No need to change the install program.

06-09-2005, 02:42 AM
You could update the database while running with new checkbox controls.
You'll need to update the Controls table.

Like so:
' Add new checkbox control to a dialog
Dim query
Dim view
' Mind the quotes: ` and ' are different!!
query = "INSERT INTO `Control` ( _
`Dialog_`, `Control`, `Type`, `X`, `Y`, `Width`, `Height`, `Attributes`, `Property`) VALUES _
( 'InstallWelcome', 'NewCheckBox', 'CheckBox', 100, 100, 100, 18, 3, 'CHECKBOXPROPERTY') TEMPORARY
Set view = Session.Database.OpenView(query)

06-09-2005, 08:43 AM
Right, to create some types of dynamic information in Windows Installer, you need to modify the in-memory MSI database, as described in this InstallShield newsletter article: http://www.installshield.com/news/newsletter/0302-articles/msiaccess.asp.

(As an aside, the form [PROPNAME] doesn't work in the Feature display name because the Title and Description fields of the Feature table use the Text data type and not the Formatted data type, as described in the MSI Help Library.)

06-10-2005, 09:10 AM
Cool. Thanks and I was able to get it to work. However, now I have another slight problem. I edited the CustomSetup dialog (basically removed the TreeView for more space) and now populate the dialog dynamically with checkboxes. Although, I am able to fit all the checkboxes in the dialog I feel that in the future the number of checkboxes may not fit the dialog. Is there a scrollable list into which I can insert my checkboxes so users can scroll if there are multiple checkboxes. I really dont want to break the features into 2 separate dialog boxes.
Alternatively, I am open to using the SelectionTree as well. Can I simply insert rows into the Feature table. Anything else I should do to figure out what the user selects.

12-05-2006, 09:08 AM
I am new to InstallShield and I am trying to implement the feature that is discussed in this topic. Dynamically add checkbox to a dialog.
I got the code that is posted here, but I dont have a clue of where to put that code. In which function etc ??
Can someone help me out?

Thanks in advance,

12-05-2006, 11:01 AM
Before going down this road, are you using a Basic MSI project? Would it be an option to have a check box hidden by default, but displayed if a certain condition is met? That's much easier than modifying the in-memory MSI database tables.

12-06-2006, 10:56 AM
Yes, it is a basic msi project and Yes, I would prefer having a checkbox that is easy to manipulate. I need a simple checkbox for each of the feature and disable/enable/hide/show them on certain conditions.
The conditions are read from a xml file on the local machine.
WHen I select "custom" in setup type and click "next", I should be able to see my features with the required conditions (disable/hide etc). Where shld I put my code?
Can you suggest me a good option for this?