Properties changed in the UI must be public properties, which means that
their names must be all in upper-case.
http://msdn.microsoft.com/en-us/library/aa367437%28v=vs.85%29.aspx

Also, to enable a property to be transferred from the UI sequence to the
execute sequence, it must be marked "secure" by adding Secure="yes" to the
property element. (Secure properties must also be public properties).

-----Original Message-----
From: Yuri Sevastyanov [mailto:y...@tightvnc.com] 
Sent: 13 September 2011 07:27
To: wix-users@lists.sourceforge.net
Subject: [WiX-users] GUI properties do not work in component conditions.

Hi All,

I'm trying to install a component that has a condition based on a GUI 
checkbox property.
I preset the property to the "1" value to set it to the checked state:

    <Property Id='write_to_registry_check_box_value'> 1 </Property>
...
            <Control Id="WriteToRegistryBox" Type="CheckBox" X="25" Y="75"
                 Width="300" Height="15" 
Property="write_to_registry_check_box_value"
                 CheckBoxValue="1" Text="Write to registry"/>
...
If we check such a property value on pushing the "Next" button, it works 
perfectly. However, it does not work in a component condition (always 
"1"). Also, the property doesn't  work in a custom action.

I use wix 3.5 on Windows 7 professional (UAC is on).

After the signature, I've included a complete example which should 
demonstrate the problem.

Thank you!

-- 
Best Regards,
Yuri Sevastyanov,
TightVNC Team

Example code:

<?xml version='1.0' encoding='Windows-1252'?>
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>

  <Product
    Name='Product_name1'
    Id='{14CA11E9-67FE-4d3f-854F-B361FE3884F4}'
    UpgradeCode='{A442C09E-7050-4bdf-B95D-0520A06E8EF0}'
    Language='1033'
    Codepage='1252'
    Version='2.0.0.0'
    Manufacturer='Manufacturer_name1'
  >
    <Package
      Id='*'
      Keywords='Installer'
      Manufacturer='Manufacturer_name1'
      InstallerVersion='310'
      Platform='x64'
      Compressed='yes'
      InstallPrivileges='elevated'
      InstallScope='perMachine'
    />

    <Upgrade Id='{A442C09E-7050-4bdf-B95D-0520A06E8EF0}'>
      <UpgradeVersion OnlyDetect='no' Property='PREVIOUSFOUND'
        Minimum='1.0.99.0' IncludeMinimum='yes'
        Maximum='2.0.0.0' IncludeMaximum='no' />
    </Upgrade>

    <Media Id='1' Cabinet='setup.cab' EmbedCab='yes' />

    <Directory Id='TARGETDIR' Name='SourceDir'>
      <Directory Id='ProgramFiles64Folder' Name='PFiles'>
        <Directory Id='INSTALLDIR' Name='Product_name'>
          <Component Id='serverExe' 
Guid='{24E8B47B-DA2F-4874-8474-051A4C4226E1}' Win64='yes'>
            <File Id='someEXE' Name='tvnserver.exe' DiskId='1' 
Source='server.exe' KeyPath='yes'>
            </File>
          </Component>
        </Directory>
      </Directory>


      <Component Id='TestRegistryWriting'
                 Feature='Complete'
                 Guid='{9604D771-3D6C-4f75-ADFD-CA3B4BE7ECA1}'
                 Permanent='yes'>
        <RegistryValue Id='TestRegistryWriting_RegValue' Action='write'
                       Root='HKLM' Key='Software\Product_name'
                       Name='Test_registry_writing' Value='0' 
Type='integer'>
          <Permission GenericAll='yes' User='System'/>
          <Permission GenericAll='yes' User='Administrators'/>
        </RegistryValue>
        <Condition>
          <!-- The write_to_registry_check_box_value value is always 1
               and the component installes always too. Even if the 
checkbox is
               unchecked. -->
          write_to_registry_check_box_value = 1
        </Condition>
      </Component>
    </Directory>

    <Feature Id='Complete'
             Title='Products'
             Description='You can check the folowing elements to install'
             Display='expand'
             Level='1'
             ConfigurableDirectory='INSTALLDIR'>
      <Feature Id='Server'
               Title='Server'
               Description='Server Description'
               Level='1'>
        <ComponentRef Id='serverExe' />
      </Feature>
    </Feature>

    <Property Id='A_PROPERTY'> 1 </Property>
    <!-- Condition initialization -->
    <SetProperty Id='use_auth_checkbox_value' Value='1'
                 After='FindRelatedProducts'> A_PROPERTY = 1 </SetProperty>
    <!-- Unconditional initialization -->
    <Property Id='write_to_registry_check_box_value'> 1 </Property>

    <UI Id='UI_ID'>
      <UIRef Id="WixUI_Mondo" />
      <UIRef Id="WixUI_ErrorProgressText" />

      <Dialog Id="ServiceConfig" Width="370" Height="270"
              Title="Setup" NoMinimize="yes">
        <Control Id="UseAuthCheckBox" Type="CheckBox" X="25" Y="55"
                 Width="300" Height="15" Property="use_auth_checkbox_value"
                 CheckBoxValue="1" Text="Use auth"/>
        <Control Id="WriteToRegistryBox" Type="CheckBox" X="25" Y="75"
                 Width="300" Height="15" 
Property="write_to_registry_check_box_value"
                 CheckBoxValue="1" Text="Write to registry"/>
        <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56"
                 Height="17" Text="&amp;Back">
          <Publish Event="NewDialog" Value="CustomizeDlg" Order="1">
            WixUI_InstallMode = "InstallCustom" OR WixUI_InstallMode = 
"Change"
          </Publish>
          <Publish Event="NewDialog" Value="SetupTypeDlg" Order="2">
            WixUI_InstallMode = "InstallTypical" OR WixUI_InstallMode = 
"InstallComplete"
          </Publish>
        </Control>
        <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" 
Height="17" Default="yes" Text="&amp;Next">
          <Publish Event="NewDialog" Value="VerifyReadyDlg">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>

        <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" 
Height="44" TabSkip="no" Text="WixUI_Bmp_Banner" />
        <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" 
Height="0" />
        <Control Id="Title" Type="Text" X="15" Y="6" Width="200" 
Height="15" Transparent="yes" NoPrefix="yes">
        </Control>
        <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" 
Height="0" />
      </Dialog>

      <Publish Dialog="SetupTypeDlg" Control="TypicalButton" 
Event="NewDialog" Value="ServiceConfig" Order="2">1</Publish>
      <Publish Dialog="SetupTypeDlg" Control="CompleteButton" 
Event="NewDialog" Value="ServiceConfig" Order="2">1</Publish>

      <Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog"
               Value="ServiceConfig" Order="2">
        (WixUI_InstallMode = "InstallTypical" OR WixUI_InstallMode = 
"InstallComplete" OR
        WixUI_InstallMode = "InstallCustom" OR WixUI_InstallMode = 
"Change") AND
        (<![CDATA[&Server=3]]>)
      </Publish>

      <Publish Dialog="VerifyReadyDlg" Control="Back"
               Event="NewDialog" Value="ServiceConfig" Order="10">
        1
      </Publish>
    </UI>

    <CustomAction Id="SetPasswordAction"
                  FileKey="someEXE"
                  ExeCommand="-setpass"
                  Impersonate="no"
                  Execute="commit"
                  Return="ignore" />

    <InstallExecuteSequence>
      <RemoveExistingProducts After="InstallInitialize" />

      <Custom Action="SetPasswordAction" Before="InstallFinalize">
        <!-- The use_auth_checkbox_value value is always 1
             and the CA starts always too. Even if the checkbox is
             unchecked. -->
        use_auth_checkbox_value = 1 AND <![CDATA[&Server=3]]> AND NOT REMOVE
      </Custom>
    </InstallExecuteSequence>

  </Product>
</Wix>



-----------------------------------------------------------------------------
-
BlackBerry&reg; DevCon Americas, Oct. 18-20, San Francisco, CA
Learn about the latest advances in developing for the 
BlackBerry&reg; mobile platform with sessions, labs & more.
See new tools and technologies. Register for BlackBerry&reg; DevCon today!
http://p.sf.net/sfu/rim-devcon-copy1 
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users
SDL PLC confidential, all rights reserved.
If you are not the intended recipient of this mail SDL requests and requires 
that you delete it without acting upon or copying any of its contents, and we 
further request that you advise us.
SDL PLC is a public limited company registered in England and Wales.  
Registered number: 02675207.
Registered address: Globe House, Clivemont Road, Maidenhead, Berkshire SL6 7DY, 
UK.


------------------------------------------------------------------------------
BlackBerry&reg; DevCon Americas, Oct. 18-20, San Francisco, CA
Learn about the latest advances in developing for the 
BlackBerry&reg; mobile platform with sessions, labs & more.
See new tools and technologies. Register for BlackBerry&reg; DevCon today!
http://p.sf.net/sfu/rim-devcon-copy1 
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to