How to resolve ICE03: String overflow in WiX? - wix

In my installer a feature tree control in the maintenance dialog publishes two events that sets a property named DisableInstallBtn to 0 or 1, respectively. And DisableInstallBtn is used by the condition of enable/disable action of Install button. It behaves like this: If all the features are 'deselected' then the Install button becomes disabled.
So, each event(Publish element) has a condition to be published. For example, the event that sets DisableInstallBtn to 1 has a condition like this: <![CDATA[(!Feature1=2 OR &Feature1=2) AND ... AND (!FeatureN=2 OR &FeatureN=2)]]>(If you don't understand the syntax of this condition you can check http://wix.tramontana.co.hu/tutorial/com-expression-syntax-miscellanea/expression-syntax)
The problem is this condition string is too long so that I get String overflow warning when I compile .wxs file. Is there any way to resolve this problem? Thanks.

WiX's built-in CustomizeDlg (located under src\ext\UIExtension\wixlib if you have the source code) already has the functionality you're looking for in its next button. Just subscribe to the SelectionNoItems event.
<Control Id="Install" Type="PushButton">
<Subscribe Event="SelectionNoItems" Attribute="Enabled" />
</Control>
The SelectionTree control has a lot of events associated with it. You can view them here.
EDIT
It seems that I've misunderstood the documentation. The SelectionNoItems only fires when the selection tree has no nodes, not when the current selection has no nodes.
Starting with Windows Installer 3.0, the selection tree publishes a DoAction event, which fires when there's a change in your selection tree.
You can then check your feature selection in your custom action and set the Control.Attributes column of your next button. You can see here for a list of attributes and their values (enabled is equal to 2).
Otherwise, you can always do your validation on clicking next.

Related

MSI Installer and Required Radio Button Selection

I'm using VS 2010 and need to make a change in an MSI installer.
I'm not that familiar with the installer creation -- it seems very limited.
I needed to add a new dialog that pops up and asks the user to select one of two possible installation directories. The dialog is the "RadioButtons (2 buttons)" dialog.
Depending on which radio button you select, the ButtonProperty sets TARGETDIR to either:
[AppDataFolder]MyInstall
or
[ProgramFiles64Folder]MyInstall
I have the DefaultValue for the button set to [ProgramFiles64Folder]MyInstall
I've got everything working -- at least when the user selects one of the radio buttons.
The problems are:
The default radio button isn't preselected when the dialog is displayed and it's possible for the user to advance to the next screen without selecting one of the radio buttons. How can I prevent that?
When the default value is set to something like [ProgramFiles64]MyInstall, on uninstall I get an error that it could not access the network location [ProgramFiles64]MyInstall -- even if that is not the location where the files were installed. If the path for the DefaultValue is a fully expanded absolute path, then there is no error.
With this code you van preselect the radiobutton: radiobutton.Checked = true

Copy user input from one custom dialog to another

I have 2 custom dialogs. They are essentially copies of each other. The idea is that there are some scenarios when the user will be presented with both dialogs, and when that happens, it is highly likely that most/all of the data will be the same, but there is a chance that it won't all be the same, and the user needs to be given the opportunity to have different values between the two dialogs.
What I'd like to do is either default the values in the second dialog to the values of the first dialog, or have a checkbox in the second that will copy the values. Either way, I need to be able to set the property values. I can either do it automatically when the user transitions between the two dialogs, or do it upon the user checking a checkbox. I would be happy with either solution.
I've looked into the SetProperty element, but from what I understand, that only works on pre-defined MSI actions, and I don't believe any of those actions will work for me.
Any help would be appreciated.
I figured it out. I was looking in the wrong area.
I ended up going with a PushButton as it actually made more sense.
I was able to copy the values when the user clicks the PushButton using the Publish element under my UI element. My Publish element looks like this:
<Publish Dialog="TargetDialog" Control="CopyButton" Property="PROPERTY_NAME" Value="[SOURCE_PROPERTY_NAME]">1</Publish>
I have 4 more of the same publish tag, with the only difference being the property and value attributes.
I hope this helps other people!

Is it possible to paste into an masked edit control in a windows installer?

Starting off with what I need the end result to be:
Customer is able to paste a product key, of the correct format, off of the clipboard into an input box during the install.
Where I am at the minute:
We use WiX to create our MSI. We currently use a masked edit control which works fine. The product key verification is already done using a custom action when pressing the 'next' button. The product key verification should remain the same, only the input method is the issue.
I've spent the last day researching the possible ways of achieving this and have a few ideas, although i'm not sure if any of them will work. I've already ruled out trying to trigger a custom action on paste because I know MSI has no way of capturing that event.
So, my thoughts are a 'paste from clipboard' button. This would trigger a custom action which would capture the clipboard item, decide whether or not it looks like a product key (that would be the easy part) and then somehow paste that into edit control. Note how I say edit control, I'm not sure it would be at all possible with a masked edit control and i'm not certain it'd even work with a standard edit control. I already have a custom action which manages to check whether the licence text has been viewed, and this is achieved by finding the window and the 'richedit' class window where the licence resides and retrieving the scroll position. I had thought that this method may allow me to set the edit control to my clipboard key, again though, I'm not certain this would work.
I have already read about the possibility of writing my own UI controller. I know this is a big task but nothing is ruled out at this stage, I just have no idea where to start.
My final idea, although I have no thoughts on how it could be implemented, would be by changing my masked edit control to a standard edit control, which would obviously allow the full product key to be pasted, although without using a custom action to verify it is in the correct format i'll still be no further forward. But this would then require for some sort of automatic adding of dashes if the customer was to type the product key in manually.
Could anyone can shed any light on the feasibility of any of my ideas and how to implement them or any other ways of meeting my goal?
I have managed to do this using the 'paste from clipboard' option I originally thought of. I added a button to my form, which calls a custom action which queries the clipboard and, if successful, sets two properties in the installer. One containing the formatted product key, and one a basic property to tell whether or not the clipboard operation has been successful or not. The masked edit control is linked to the product key property, and by refreshing the control,
<Publish Event="Reset" Value="0" Order="3">ClipboardSuccess = 1</Publish>
the product key is populated in the masked edit control.

Is it possible to have an extension library dialog box within a repeat control?

I'm running with an 8.5.3 UP1 server and I have a need to have many dialog boxes (for confirmation purposes) for a whole bunch of "action buttons" on an xpage. The code for these dialog boxes is almost exactly the same with the exception of the confirmation message being different and the client-side JS function they are calling if the Yes button is selected.
Since I really hate repeating code over and over, I was wondering if it is at all possible to put a xe:dialog control within a repeat control and specify the message and function call from an array of values? I know I can't compute the ID of the dialog control and without that I'm not sure how I would reference the dialog to open and close it.
Any ideas? Thanks
Yes, this is possible.
Make sure that you specify that the dialog box's property for keepComponents is set to False. You don;t have to do anything special for opening or closing the dialog box, just use whatever ID you give the dialog box in you client-side action to open the dialog box in the repeat such as XSP.openDialog('#{id:myDialog}')
The XPages renderer will automatically calculate the correct ID names for you.

Include ServiceDependancy if checkbox selected WIX

Is it possible to include a ServiceDependency based on whether a checkbox was selected in a WIX application?
Your check box control will likely set a property. You could then use a condition on a component to control if that component, which adds the service dependency, is installed.