mat_bruges
Posts: 33
Joined: Tue Mar 11, 2008 12:28 am

Init checkbox value and use like radiogroup

Hi,

I have created a custom dialog where I let the user select the software that is designed for the .NET framework version they want to install: 1.1 or 2.0.

Since I need to disable any options that are not valid, I want to disable for example the software for .NET 2.0 if that version of the CLR is not available on the machine. I initially wanted to do this using a radiobutton, but since there is no way to disable a single radiobutton I am using checkboxes instead.

If multiple versions of the .NET CLR are available on the machine, I want to tick the checkbox for the most current version, but still allow the user to change.

How do I do that? I have created 2 "INIT" events where I set the property for each checkbox depending on what I find in the registry. This seemed to work, except that the user can no longer check or uncheck a checkbox. They immediately jump beack to their default values. I presume the INIT event is trigger with each control event, and not when the dialog loads?

1) Is there an event available for when the dialog loads? Or where do I need to initialise these values? I can probably do this in the next button of the previous dialog, but then I will have to implement this 4 times: first time install, maintenance, etc..

2) I only want to allow exactly 1 checkbox to be checked. The radiobutton would be perfect for this but as I mentioned above I can't use it. How do I implement the same thing using checkboxes?

3) Also: where can I find more information about the dialog event actions? There are options there like "AddLocal, Remove, DirectoryListUp,.." What does all this mean, where is this explained?

Thanks

Mat
gabriel
Posts: 15
Joined: Mon Mar 17, 2008 3:39 pm
Location: Craiova
Contact: Yahoo Messenger

Hi,
Is there an event available for when the dialog loads? Or where do I need to initialize these values?
Your solution with 2 INIT Events is correct, and should set the properties only when the dialog loads.
I only want to allow exactly 1 checkbox to be checked. The radiobutton would be perfect for this but as I mentioned above I can't use it. How do I implement the same thing using checkboxes?
Please follow these steps to accomplish this:

1) create a VB Script file with the following code :

Code: Select all

Function Check1Clicked()
  If Session.Property("CHECK1")="" Then
    Session.Property("CHECK1") = "true"    
  Else
    Session.Property("CHECK2") = ""
  End If
End Function

Function Check2Clicked()
  If Session.Property("CHECK2")="" Then
    Session.Property("CHECK2") = "true"
  Else
    Session.Property("CHECK1") = ""
  End If
End Function
2) Set the property names of the 2 checkboxes to CHECK1, and CHECK2 respectively.

3) Create 2 New Attached Custom Actions under UI Custom Actions, and point them to the VB script created in step 1.
4) Name these actions Check1Clicked, and Check2Clicked.
5) Set the Function Name property of these actions to their corresponding Function name inside the Vb script(Check1Clicked and Check2Clicked)
6) Go to your CHECK1 checkbox and create 3 Published Events (one DoAction event and 2 SetProperty events):
DoAction Check1Clicked AI_INSTALL
[CHECK1] [CHECK1] AI_INSTALL
[CHECK2] [CHECK2] AI_INSTALL
7) Go to your CHECK2 checkbox and create 3 Published Events (one DoAction event and 2 SetProperty events):
DoAction Check2Clicked AI_INSTALL
[CHECK1] [CHECK1] AI_INSTALL
[CHECK2] [CHECK2] AI_INSTALL
More information about dialog event actions can be found here:
http://www.advancedinstaller.com/user-g ... ialog.html
http://www.advancedinstaller.com/user-g ... te-ca.html
http://www.advancedinstaller.com/user-g ... perty.html
Also: where can I find more information about the dialog event actions? There are options there like "AddLocal, Remove, DirectoryListUp,.." What does all this mean, where is this explained?
For more details about Windows Installer control events please see the following page:
http://msdn2.microsoft.com/en-us/librar ... S.85).aspx

Regards,
Ovidiu
___________
Ovidiu Blejdea
Advanced Installer Team
http://www.advancedinstaller.com
mat_bruges
Posts: 33
Joined: Tue Mar 11, 2008 12:28 am

Thanks Ovidiu, but the initialisation part does not seem to work as expected. When I run the setup and it displays the dialog with the 2 checkboxes, it ensures that the correct one is checked by default.

However, I can not change the checkbox values. The checkboxes are enabled, but when I try to check or uncheck them they just keep their setting and do not change.

Perhaps I'm doing something wrong, here's what I did:

1) In the "Init Events" of my custom dialog, I clicked the "New" button
2) For the control event name, I selected "SetProperty"
3) The name then changes to "[PropertyName]", and I change this to the name of the property I want to set: "[FRAMEWORK_NET_11]" (<- I find this a bit confusing by the way, I had to click the "..." button in the Argument first to select the property I need, and then copy and paste this to the Name field)
4) I set the Argument to "1" (the default value for this checkbox property was an empty string)
5) I set the condition to this: "(DOTNET11="3706-4322") AND (DOTNET20<>"50727-50727")" This is using 2 search properties to check the dotnet version. So this is checking the .NET 1.1 checkbox if .Net 1 1 is available and .Net 2.0 is not available.

I followed the same approach for the second checkbox.

There is no other event code in this dialog.

Any idea what I'm doing wrong?

Thanks

Mat
gabriel
Posts: 15
Joined: Mon Mar 17, 2008 3:39 pm
Location: Craiova
Contact: Yahoo Messenger

Hi,

I managed to replicate this behavior on my machine, by deleting the string from the VALUE field in the "Properties" list, for both checkboxes.

It seems that this field must contain a value, in order for the checkboxes to work properly.

Please check the state of these fields from your project, and if necessary change them to a relevant value. If that does not work, please send us your .aip file to support at advancedinstaller dot com.

For further reference please check this MSDN page explaining the Windows Installer Checkbox control:
http://msdn2.microsoft.com/en-us/librar ... S.85).aspx


Regards,
Ovidiu
_________________
Ovidiu Blejdea
Advanced Installer Team
http://www.advancedinstaller.com
mat_bruges
Posts: 33
Joined: Tue Mar 11, 2008 12:28 am

I got that working now, thanks!
mat_bruges
Posts: 33
Joined: Tue Mar 11, 2008 12:28 am

Re: Init checkbox value and use like radiogroup

I thought this was working OK, but one of my users is having a problem with this setup on VISTA. It seems to work fine on XP.

This is the error section in the log:

Code: Select all

Info 2898. For DlgFontBold8 textstyle, the system created a 'Tahoma' font, in 0 character set, of 13 pixels height.
DEBUG: Error 2826:  Control BottomLine on dialog ProductsDialog extends beyond the boundaries of the dialog to the right by 3 pixels
The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2826. The arguments are: ProductsDialog, BottomLine, to the right
DEBUG: Error 2826:  Control BannerLine on dialog ProductsDialog extends beyond the boundaries of the dialog to the right by 3 pixels
The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2826. The arguments are: ProductsDialog, BannerLine, to the right
Action 17:29:13: ProductsDialog. Dialog created
MSI (c) (4C:D4) [17:29:14:909]: PROPERTY CHANGE: Adding FRAMEWORK_NET_35 property. Its value is 'true'.
DEBUG: Error 2826:  Control BottomLine on dialog FrameworkDlg extends beyond the boundaries of the dialog to the right by 3 pixels
The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2826. The arguments are: FrameworkDlg, BottomLine, to the right
DEBUG: Error 2826:  Control BannerLine on dialog FrameworkDlg extends beyond the boundaries of the dialog to the right by 3 pixels
The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2826. The arguments are: FrameworkDlg, BannerLine, to the right
Action 17:29:14: FrameworkDlg. Dialog created
MSI (c) (4C:D4) [17:29:15:906]: Doing action: FrameworkDlgNextClicked
Action 17:29:15: FrameworkDlgNextClicked. 
Action start 17:29:15: FrameworkDlgNextClicked.
Action ended 17:29:15: FrameworkDlgNextClicked. Return value 3.
DEBUG: Error 2896:  Executing action FrameworkDlgNextClicked failed.
The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2896. The arguments are: FrameworkDlgNextClicked, , 
Action ended 17:29:15: WelcomeDlg. Return value 3.
MSI (c) (4C:7C) [17:29:15:917]: Doing action: FatalError
Action 17:29:15: FatalError. 
Action start 17:29:15: FatalError.
DEBUG: Error 2826:  Control BottomLine on dialog FatalError extends beyond the boundaries of the dialog to the right by 3 pixels
The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2826. The arguments are: FatalError, BottomLine, to the right
Action 17:29:15: FatalError. Dialog created
Action ended 17:29:19: FatalError. Return value 2.
Action ended 17:29:19: INSTALL. Return value 3.
MSI (c) (4C:7C) [17:29:19:332]: Destroying RemoteAPI object.
MSI (c) (4C:68) [17:29:19:333]: Custom Action Manager thread ending.
I have 4 checkboxes that control which feature will be installed. I have 4 features, each for a specific version of the .NET framework. When the user clicks the "Next" button, the following code runs to ensure the correct feature gets installed:

Code: Select all

Function FrameworkDlgNextClicked() 
  Session.FeatureRequestState("eID_Framework_Runtime_1.1") = 2
  Session.FeatureRequestState("eID_Framework_Runtime_2.0") = 2
  Session.FeatureRequestState("eID_Framework_Runtime_3.0") = 2
  Session.FeatureRequestState("eID_Framework_Runtime_3.5") = 2

  If Session.Property("FRAMEWORK_NET_11")="true" Then 
    Session.FeatureRequestState("eID_Framework_Runtime_1.1") = 3
  ElseIf Session.Property("FRAMEWORK_NET_20")="true" Then
    Session.FeatureRequestState("eID_Framework_Runtime_2.0") = 3
  ElseIf Session.Property("FRAMEWORK_NET_30")="true" Then
    Session.FeatureRequestState("eID_Framework_Runtime_3.0") = 3
  ElseIf Session.Property("FRAMEWORK_NET_35")="true" Then
    Session.FeatureRequestState("eID_Framework_Runtime_3.5") = 3
  End If
End Function
The log seems to indicate that the problem is happening in this function. But why only on VISTA?

My user is an admin on the machine, and he has switched off DEP and is running the setup using the "Run As Administrator" option.

Any ideas?

Thanks

Mat
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Init checkbox value and use like radiogroup

Hi,

Can you reproduce this behavior on other Vista machines? If this is the case please send us the AIP you are using and the generated installation package (if they don't contain confidential information) or a small test case which reproduces this behavior to support at advancedinstaller dot com so we can investigate it.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”