Reputation: 7072
I need to create a Wix Installer, that will allow me to have a dialog, where the user can type in a serial number, then I need to save the serial number they entered into the Windows registry.
Also, if they don't enter a serial number, the next button needs to be disabled, so that they cannot proceed with the installation, if they do not enter a serial number.
Upvotes: 3
Views: 1999
Reputation: 4277
WIX does not support key events like the one you want the next button must be enabled when the user enters the key. Best option is to provide the next button and call a custom action to check whether the key is correct, if un-correct throw error message.
<Dialog Id="UserRegistrationDlg" Width="370" Height="270" Title="[ProductName] [Setup]" NoMinimize="yes">
<Control Id="OrganizationLabel" Type="Text" X="45" Y="80" Width="100" Height="15" TabSkip="no" Text="&Organization:" />
<Control Id="OrganizationEdit" Type="Edit" X="45" Y="95" Width="220" Height="18" Property="COMPANYNAME" Text="{80}" />
<Control Id="CDKeyLabel" Type="Text" X="45" Y="125" Width="50" Height="10" TabSkip="no">
<Text>License &Key:</Text>
</Control>
<Control Id="CDKeyEdit" Type="MaskedEdit" X="45" Y="140" Width="250" Height="16" Property="PIDKEY" Text="[PIDTemplate]" />
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="&Back">
<Publish Event="NewDialog" Value="[WixUI_UserRegistrationDlg_Back]">1</Publish>
</Control>
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="&Next">
<Publish Event="ValidateProductID" Value="0">0</Publish>
<Publish Event="DoAction" Value="CheckingPID">1</Publish>
<Publish Event="SpawnDialog" Value="InvalidPidDlg">PIDACCEPTED = "0"</Publish>
<Publish Event="NewDialog" Value="[WixUI_UserRegistrationDlg_Next]">PIDACCEPTED = "1"</Publish>
</Control>
<Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="Cancel">
<Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
</Control>
</Dialog>
<Dialog Id="InvalidPidDlg" Width="260" Height="85" Title="[ProductName] [Setup]" NoMinimize="yes">
<Control Id="Return" Type="PushButton" X="100" Y="57" Width="56" Height="17" Default="yes" Cancel="yes" Text="Ok">
<Publish Event="EndDialog" Value="Return">1</Publish>
</Control>
<Control Id="Text" Type="Text" X="48" Y="15" Width="194" Height="30" TabSkip="no">
<Text>[USERERRMSG]</Text>
</Control>
</Dialog>
InvlaidPidDlg will show error message. From custom action you need to set the value of 'USERERRMSG'
Upvotes: 2
Reputation: 1870
Here is a possible solution: http://wix.tramontana.co.hu/tutorial/events-and-actions/how-to-manage
Upvotes: 1
Reputation: 30127
Take a look at this post which explains how you can create customized dialog in Wix based installer
Upvotes: 1