Hi,
Here is an example I wrote to do something on features. There are three
featrues "VC71" "VC70" "VC90", and when installing user can only choose one of
them and install the matching feature.
In a dialog, I created a listbox:
<Control Id="IDEType" Type="ComboBox" X="25" Y="117" Width="290" Height="25"
Property="IDE" Sorted="yes" RightToLeft="no" ComboList="yes" >
<ComboBox Property="IDE">
<ListItem Text="VC71" Value="71"/>
<ListItem Text="VC80" Value="80"/>
<ListItem Text="VC90" Value="90"/>
<ListItem Text="null" Value="0"/>
</ComboBox>
</Control>
Then in the "Next" button event:
<Publish Event="AddLocal" Value="VC71BinFt">1</Publish>
<Publish Event="AddLocal" Value="VC80BinFt">1</Publish>
<Publish Event="AddLocal" Value="VC90BinFt">1</Publish>
<Publish Event="Remove" Value="VC71BinFt"><![CDATA[IDE <> "71"]]></Publish>
<Publish Event="Remove" Value="VC80BinFt"><![CDATA[IDE <> "80"]]></Publish>
<Publish Event="Remove" Value="VC90BinFt"><![CDATA[IDE <> "90"]]></Publish>
These can finish features adding and removing according to user's selection.
if you want to select features according to its state, here is another way.
In a button event:
<Publish Event="AddLocal" Value="VCBinFt">
<![CDATA[!VC71BinFt = 3 OR !VC71BinFt = 3 OR !VC80BinFt = 3 OR !VC80BinFt =
4 OR !VC90BinFt = 3 OR !VC90BinFt = 4]]>
</Publish>
Put this in the event before FeatureTree dialog, it can affect the features
state in the tree.
Does this meet you?
2009-11-30
salever.lee
发件人: [email protected]
发送时间: 2009-11-30 10:37:55
收件人: [email protected]
抄送:
主题: Re: [WiX-users] Select features on UI
Thanks,
If I specify a property that ADDLOCAL, REMOVE are some features from
command-line, It does work.
If A feature is specfied, it does work.
Some features are specified value of Events that are AddLocal or Remove.
But the FeatureTree dialog, use WiXUI library, don't enable these features.
I create CustomAction, and some features' state changed to INSTALLSTATE_LOCAL (
using a function MsiSetFeaturesState in C++ ).
and this function is called by DoAction Event.
I create sample code:
CA:
UINT _stdcall PkgSetFeatureChange( MSIHANDLE hInstall ) {
:
MsiGetProperty( hInstall, L"PKGTYPE", szPkgType, &dwLen );
if( !wcsstr( "A", szPkgType ) ) {
MsiSetFeatureState( hInstall, "F0", INSTALLSTATE_LOCAL );
MsiSetFeatureState( hInstall, "F1", INSTALLSTATE_LOCAL );
}
}
in WiX:
<CustomAction Id="CA" Binary="XXXX.dll" DllEntry="PkgSetFeatureChange" .... />
:
<Control Id="Next" ..
<Publish Event="DoAction" Value="CA" >1</Publish>
:
I don't understand why It dosen't work that value of Event="AddLocal" or
Event="Remove" is specified some features.
Thanks,
Akihiro Shibuta.
> -----Original Message-----
> From: Blair [mailto:[email protected]]
> Sent: Friday, November 27, 2009 4:12 PM
> To: 'General discussion for Windows Installer XML toolset.'
> Subject: Re: [WiX-users] Select features on UI
>
> As I understand it, a feature can have only one parent.
>
> If you want to use control events, something like this
> (borrowed from Arun) should work:
>
> In the <Control id=Next
> Add <Publish Event="Addlocal"
> Value="F0,F2"><![CDATA[(PKGTYPE="A")]]></Publish>
> <Publish Event="Addlocal"
> Value="F0,F1"><![CDATA[(PKGTYPE="B")]]></Publish>
> <Publish Event="Addlocal"
> Value="F1,F2"><![CDATA[(PKGTYPE="C")]]></Publish>
> <Publish Event="Remove"
> Value="F1"><![CDATA[(PKGTYPE="A")]]></Publish>
> <Publish Event="Remove"
> Value="F2"><![CDATA[(PKGTYPE="B")]]></Publish>
> <Publish Event="Remove"
> Value="F0"><![CDATA[(PKGTYPE="C")]]></Publish>
>
> Possibly even better (instead of the above), if you want just
> the PKGTYPE property to always control the features (so you
> can also set the package type from the command-line and you
> won't be required to use the UI):
>
> <Feature Id="F0" Level="32767"/>
> <Feature Id="F1" Level="32767"/>
> <Feature Id="F2" Level="32767"/>
> <Property Id="PKGTYPE" Secure="yes"/>
>
> <!-- Package A -->
> <SetProperty Id="AddLocalPkgAFeatures" Value="F0,F2" Sequence="both"
> Before="SetRemovePkgAFeatures">PKGTYPE="A" AND NOT REMOVE=ALL
> AND Preselected!=1</SetProperty> <SetProperty
> Id="RemovePkgAFeatures" Value="F1" Sequence="both"
> Before="SetAddLocalPkgBFeatures">PKGTYPE="A" AND NOT
> REMOVE=ALL AND Preselected!=1</SetProperty>
>
> <!-- Package B -->
> <SetProperty Id="AddLocalPkgBFeatures" Value="F0,F1" Sequence="both"
> Before="SetRemovePkgBFeatures">PKGTYPE="B" AND NOT REMOVE=ALL
> AND Preselected!=1</SetProperty> <SetProperty
> Id="RemovePkgBFeatures" Value="F2" Sequence="both"
> Before="SetAddLocalPkgCFeatures">PKGTYPE="B" AND NOT
> REMOVE=ALL AND Preselected!=1</SetProperty>
>
> <!-- Package C -->
> <SetProperty Id="AddLocalPkgCFeatures" Value="F1,F2" Sequence="both"
> Before="SetRemovePkgCFeatures">PKGTYPE="C" AND NOT REMOVE=ALL
> AND Preselected!=1</SetProperty> <SetProperty
> Id="RemovePkgCFeatures" Value="F0" Sequence="both"
> Before="SetADDLOCAL">PKGTYPE="C" AND NOT REMOVE=ALL AND
> Preselected!=1</SetProperty>
>
> <!-- Actually set the features based on the above table -->
> <SetProperty Id="ADDLOCAL"
> Value="[AddLocalPkgAFeatures][AddLocalPkgBFeatures][AddLocalPk
> gCFeatures]"
> Sequence="both" Before="SetREMOVE">AddLocalPkgAFeatures OR
> AddLocalPkgBFeatures OR AddLocalPkgCFeatures</SetProperty>
> <SetProperty Id="REMOVE"
> Value="[RemovePkgAFeatures][RemovePkgBFeatures][RemovePkgCFeatures]"
> Sequence="both" Before="CostInitialize">RemovePkgAFeatures OR
> RemovePkgBFeatures OR RemovePkgCFeatures</SetProperty>
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]]
> Sent: Tuesday, November 24, 2009 5:14 PM
> To: [email protected]
> Subject: Re: [WiX-users] Select features on UI
>
>
> Is Conditions changed to Features ?
>
> <Feature Id="A">
> <FeatureRef Id="F0" />
> <FeatureRef Id="F2" />
> </Feature>
> <Feature Id="B">
> <FeatureRef Id="F0" />
> <FeatureRef Id="F1 />
> </Feature>
> <Feature Id="C">
> <FeatureRef Id="F1" />
> <FeatureRef Id="F2 />
> </Feature>
> :
>
> "F0", "F1", ... have multiple parents feature. Can I construction?
> I seems a feature/compornent cannot have multiple parents
> features/compornents.
> May I tell me good idea ?
>
>
> thanks,
>
> Akihiro, Shibuta.
>
> > -----Original Message-----
> > From: Arun Perregatturv [mailto:[email protected]]
> > Sent: Tuesday, November 24, 2009 11:40 PM
> > To: General discussion for Windows Installer XML toolset.
> > Subject: Re: [WiX-users] Select features on UI
> >
> > You are missing the publish event for the value
> >
> > Something like this
> >
> > In the <Control id=Next
> > Add <Publish Event="Addlocal"
> > Value="A"><![CDATA[(PKGTYPE="A")]]></Publish>
> > <Publish Event="Remove"
> > Value="A"><![CDATA[NOT(PKGTYPE="A")]]></Publish>
> >
> > Add this for each value type.
> >
> > I do this exactly the same with 4 radiobuttons for the user
> > selection and based on the selection I set the features.
> >
> >
> > Arun Perregattur
> >
> >
> > -----Original Message-----
> > From: [email protected]
> > [mailto:[email protected]]
> > Sent: Tuesday, November 24, 2009 7:01 AM
> > To: [email protected]
> > Subject: [WiX-users] Select features on UI
> >
> >
> > Hi,
> >
> > I want to modify features by radio buttons on dialog.
> > When PKGTYPE is selected "A", features are "F0" and "F2".
> > When PKGTYPE is selected "B", features are "F0" and "F1".
> > When PKGTYPE is selected "C", features are "F1" and "F2".
> >
> > The content selected on the UI is not reflected. Where has
> > made a mistake?
> >
> > 1) Set Initialize Property "PKGTYPE"
> > 2) Select package type on radio button. and change value of
> > "PKGTYPE".
> > 3) modify Feature Condition Levels .
> > 4) Show feature tree. but the content selected on the UI is
> > not reflected
> >
> >
> >
> > <Property Id="PKGTYPE" Value="A" />
> >
> >
> >
> > <Feature Id="F0" Level="1001">
> > <Condition Level="101">PKGTYPE="A"</Condition>
> > <Condition Level="102">PKGTYPE="B"</Condition>
> > </Feature>
> > <Feature Id="F1" Level="1001">
> > <Condition Level="102">PKGTYPE="B"</Condition>
> > <Condition Level="103">PKGTYPE="C"</Condition>
> > </Feature>
> > <Feature Id="F2" Level="1001">
> > <Condition Level="101">PKGTYPE="A"</Condition>
> > <Condition Level="103">PKGTYPE="C"</Condition>
> > </Feature>
> > : ( these are many features. )
> >
> >
> > :
> >
> > <Fragment>
> > <UI>
> > <Dialog Id="PkgTypeDlg" Width="370" Height="270"
> > Title="[ProductName] Setup">
> > <Control Id="Control_Select_PackageType"
> > Type="RadioButtonGroup" X="18" Y="59" Width="329"
> > Height="119" Property="PKGTYPE">
> > <RadioButtonGroup Property="PKGTYPE">
> > <RadioButton Text="PackageA" Value="A" X="6"
> > Y="10" Width="65" Height="17"/>
> > <RadioButton Text="PackageB" Value="B" X="6"
> > Y="30" Width="65" Height="17"/>
> > <RadioButton Text="PackageC" Value="C" X="6"
> > Y="50" Width="65" Height="17"/>
> > </RadioButtonGroup>
> > </Control>
> > <Control Id="Next" Type="PushButton" X="236" Y="243"
> > Width="56" Height="17" Default="yes" Text="!(loc.UIButtonNext)">
> > <Publish Event="NewDialog"
> > Value="CustomizeDlg">1</Publish>
> > </Control>
> > :
> > </Dialog>
> > </UI>
> > </Fragment>
> >
> > Thanks,
> >
> > Akihiro, Shibuta.
> >
> >
> >
> > --------------------------------------------------------------
> > ----------------
> > Let Crystal Reports handle the reporting - Free Crystal
> > Reports 2008 30-Day trial. Simplify your report design,
> > integration and deployment - and focus on what you do best,
> > core application coding. Discover what's new with Crystal
> > Reports now. http://p.sf.net/sfu/bobj-july
> > _______________________________________________
> > WiX-users mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/wix-users
> >
> > --------------------------------------------------------------
> > ----------------
> > Let Crystal Reports handle the reporting - Free Crystal
> > Reports 2008 30-Day trial. Simplify your report design,
> > integration and deployment - and focus on what you do best,
> > core application coding. Discover what's new with Crystal
> > Reports now. http://p.sf.net/sfu/bobj-july
> > _______________________________________________
> > WiX-users mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/wix-users
> >
> --------------------------------------------------------------
> --------------
> --
> Let Crystal Reports handle the reporting - Free Crystal
> Reports 2008 30-Day
> trial. Simplify your report design, integration and
> deployment - and focus
> on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now. http://p.sf.net/sfu/bobj-july
> _______________________________________________
> WiX-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/wix-users
>
>
> --------------------------------------------------------------
> ----------------
> Let Crystal Reports handle the reporting - Free Crystal
> Reports 2008 30-Day
> trial. Simplify your report design, integration and
> deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now. http://p.sf.net/sfu/bobj-july
> _______________________________________________
> WiX-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/wix-users
>
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
WiX-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wix-users
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
WiX-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wix-users