Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » HowTo use NE operator on a Combo
HowTo use NE operator on a Combo [message #646598] Wed, 29 December 2010 03:53
St Clair Clarke is currently offline St Clair Clarke
Messages: 118
Registered: March 2010
Senior Member
Hello,
I am attempting to declaratively make visible/invisible a Combo2 widget based on the selection made in Combo1 widget.

Combo1 contains a list of religions. If Christianity is selected in Combo1, Combo2 is made visible - this I have accomplished in the code below.

I would also like for Combo2 to be made invisible again when any Combo1 item is selected except the Christianity item - this I cannot accomplished declaratively and is requesting help.

Attached is the code - the relevant portion is the Combo.Triiggers element. My attempted solution is commented - it does NOT work.

Thanks for any help.

<Composite 
    xmlns="http://www.eclipse.org/xwt/presentation" 
    xmlns:x="http://www.eclipse.org/xwt" 
    x:Class="com.epimss.reg.ui.demography.ReligionsForm"
    bindingContext="{StaticResource bindingContext}" 
    dataContext="{StaticResource religions}" 
    xmlns:lang="clr-namespace:java.lang" 
    xmlns:demography="clr-namespace:com.epimss.reg.data.demography" xmlns:v0="clr-namespace:com.epimss.shared.validators.xwt" >
    <Composite.layout>
        <FillLayout/>
    </Composite.layout>
    <Composite.Resources>
        <demography:Religions x:Key="religions"/>
        <BindingContext x:Key="bindingContext"/>
    </Composite.Resources>
    <Form x:Name="form" text="{Binding source={StaticResource bindingContext}, path=status}">
        <Form.body x:Name="form.body">
            <Form.body.layout>
                <GridLayout  numColumns="2"/>
            </Form.body.layout>
                <Label text="Religion" x:Name="religionsLbl">
        <Label.layoutData>
            <GridData horizontalAlignment="CENTER"/>
        </Label.layoutData>
    </Label>
    <Label text="Christian Denomination" x:Name="christianDenomLbl" visible="false">
        <Label.layoutData>
            <GridData horizontalAlignment="CENTER"/>
        </Label.layoutData>
    </Label>
    <Combo x:Name="religionsCombo" text="{Binding  Path=religion, updateSourceTrigger=PropertyChanged, validationRule=v0:NounValidator}">
        <Combo.layoutData>
            <GridData grabExcessHorizontalSpace="true" horizontalAlignment="FILL"/>
        </Combo.layoutData>
        <Combo.items>
            <lang:String>African Traditional</lang:String>
            <lang:String>Aetheist</lang:String>
            <lang:String>Bahai</lang:String>
            <lang:String>Buddhism</lang:String>
            <lang:String>Cao Dai</lang:String>
            <lang:String>Chinese Traditional</lang:String>
            <lang:String>Christianity</lang:String>
            <lang:String>Hinduism</lang:String>
            <lang:String>Islam</lang:String>
            <lang:String>Jainism</lang:String>
            <lang:String>Juche</lang:String>
            <lang:String>Judaism</lang:String>
            <lang:String>Neo-Paganism</lang:String>
            <lang:String>Primal-Indiginous</lang:String>
            <lang:String>Rastafarianism</lang:String>
            <lang:String>Scientology</lang:String>
            <lang:String>Shinto</lang:String>
            <lang:String>Sikhism</lang:String>
            <lang:String>Spiritism</lang:String>
            <lang:String>Tenrikyo</lang:String>
            <lang:String>Unitarian-Universalism</lang:String>
            <lang:String>Zoroastrianism</lang:String>
        </Combo.items>
        <Combo.Triggers>
            <Trigger property="text" value="Christianity">
                <Setter property="visible" value="true" targetName="christianDenomLbl"/>
                <Setter property="visible" value="true" targetName="christianDenomCombo"/>
            </Trigger>
<!--        <Trigger property="text" value="Christianity" operator="NE">
                <Setter property="visible" value="false" targetName="christianDenomLbl"/>
                <Setter property="visible" value="false" targetName="christianDenomCombo"/>
            </Trigger>  -->
    </Combo>
    <Combo x:Name="christianDenomCombo" text="{Binding  Path=christianDenom, updateSourceTrigger=PropertyChanged, validationRule=v0:NounValidator}" visible="false">
        <Combo.layoutData>
            <GridData horizontalAlignment="FILL" grabExcessHorizontalSpace="true"/>
        </Combo.layoutData>
        <Combo.items>
            <lang:String>Christian  denominations</lang:String>
            <lang:String>-----------------------------</lang:String>
            <lang:String>Anglican</lang:String>
            <lang:String>Catholic</lang:String>
            <lang:String>Evangelical</lang:String>
            <lang:String>Jehovah Witnesses</lang:String>
            <lang:String>Latter-day Saints</lang:String>
            <lang:String>Orthodox</lang:String>
            <lang:String>Pentecostal</lang:String>
            <lang:String>-----------------------------</lang:String>
            <lang:String>Non-denominational</lang:String>
        </Combo.items>
    </Combo>
        </Form.body>
        <Form.headClient>
            <Label x:Style="SEPARATOR | HORIZONTAL" x:Name="hSeparator"/>
        </Form.headClient>
    </Form>
</Composite>


class Religions
{
    String christianDenom = ""
    
    String religion = ""
}
Previous Topic:How to: XWT and Helios
Next Topic:Trigger Problems
Goto Forum:
  


Current Time: Tue Oct 21 21:38:18 GMT 2014

Powered by FUDForum. Page generated in 0.01743 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software