Feature Chooser

This topic provides you with information concerning the feature chooser as well as information about its properties.

Note: The feature chooser displays only features along with their attributes. Using VolatileInstances makes it possible for you to add attributes to this VolatileInstance and to display any kind of information in the Feature Chooser.

This page discusses:

See Also
Creating a Knowledgeware Dialog Box
About Widgets

Layout Design

A feature chooser enables you to select objects inside a proposed list.

Properties Description
Filtered Type -
Is Enabled Defines whether the component is enabled or not.
Is Shown Specifies whether the component is visible.
AttachedToBottom Specifies whether the component is attached to the bottom side of the grid.
AttachedToleft Specifies whether the component is attached to the left side of the grid.
AttachedToRight Specifies whether the component is attached to the right side of the grid.
AttachedToTop Specifies whether the component is attached to the top of the grid.
ConstantHeight Specifies whether the component has a constant height.
ConstantWidth Specifies whether the component has a constant width.
Title Corresponds to the title or to the text content of the component.

Knowledge Items

Items Description
Visibility Component display.
Sensitivity Activation of the component (react to user interactions or not).
ChosenItems List of selected items. Dynamically add or remove elements with the language changes the selection.
SelectedIndices List of indexes of the selected items. Dynamically adding or removing indices with EKL changes the selection.
ProposedItems List of items to display. Dynamically adding or removing items with EKL changes the content of the list.
TypeRestriction String that displays only the elements of a given type.
Height Height of the component in pixels.
Width Width of the component in pixels.
PresentedAttributes Names of attributes to be displayed in columns separated by commas. Example to display the name and color: Name, Color.
ColumnsWidth Attribute to define the default width value for columns of a feature chooser. If the value is -1, the width is automatically computed.
AttributesEditability Set of boolean values separated by commas to specify the editability of the FeatureChooser columns.

Events

Events on Feature Chooser Description
FeatureChosen Adds an action to execute each time a cell is selected.
FeatureAttributeEdited Adds an action to execute each time the attribute value of a selected cell is edited.
Editing Cell Values
End-users can edit cell values of multilist components (FeatureChooser and ParameterChooser) in a custom app by right-clicking the cell to be edited.

Expert-users can define which columns can be edited and can specify a particular behavior upon editing.

Note: It is impossible to edit the FeatureChooser column if the associated feature attribute/parameter is read-only.
Renaming Columns
If you want to rename one or more columns, add a CATNls file with the feature chooser name to the resource container of the know-how apps component. The new column names must be entered as follows: Original_Name="New_Name". The original names are those you can find in the Presented Attributes attribute (separated by commas) of the Feature Chooser. Use Import Files to add this file to the component. In the example below, the CATNls file name is FeatureChooser1.CATNls.

Adding an Icon

To add an icon, enter an icon name in the columnName_Icon attribute. In the example below, the first feature of the chooser is the icon named MyOwnIcon.

set f= NewFeatureChooser\ChosenItems[1]
f.SetAttributeString("Name_Icon","MyOwnIcon").

You can add icons dynamically on selection events and have the icons changed when you click the features. To do so, create a VolatileInstance and add attributes for the icon.

Adding Cell Background Color and Text Color

You can specify the background color for a cell in the Feature Chooser by adding a new string attribute to its VolatileInstance object and naming it as <AttributeName>_BackgroundColor.

Similarly, you can manage the text color of the cells in the feature chooser by adding a new string attribute and naming it as <AttributeName>_TextColor.

Here, AttributeName is the name of the attribute whose cell is to be colored. Its value range is as per RGB (Red, Green, and Blue) color value, for example, between 0-255.

The following is an example of On Init action, listing volatile instance representing musicians:

// Create a list containing some info on a few musicians.
let lMusicians (List)
lMusicians = List(
List( "Herbert Jeffrey", "Hancock", "Herbie Hancock", "M", "USA", "Piano" ),
List( "Philip David Charles", "Collins", "Phil Collins", "M", "England", "Drums" ),
List( "Candy", "Dulfer", "Candy Dulfer", "F", "Netherlands", "Saxophone" )
)
let m (Integer)
let lMusicianInfo (List)
let Instrument, IconInstrument(String)
let ColorInstrument (String)
let TextColorInstrument (String)
m = 1
TextColorInstrument = "255,255,0"
for m while m <= lMusicians.Size()
{
    // Accessing info for each musician.
    lMusicianInfo = lMusicians[m]    
    // Creating a volatile instance for each list in lMusicians.    
    let aMusician (VolatileInstance)
    aMusician = new( "VolatileInstance", "Musician", NULL )
    
    // Adding attributes to the volatile instance.
    aMusician.SetAttributeString( "Firstname", lMusicianInfo[1] )
    aMusician.SetAttributeString( "Lastname", lMusicianInfo[2] )
    aMusician.SetAttributeString( "StageName", lMusicianInfo[3] )
    aMusician.SetAttributeString( "Sex", lMusicianInfo[4] )
    aMusician.SetAttributeString( "Country", lMusicianInfo[5] )  
    // Access the Instrument played by the musician: it is the 6th element of each list of the list.
    Instrument = lMusicianInfo[6]  
    // Set the icon to display in front of the instrument.
    if Instrument == "Piano"
    {
        IconInstrument = "Piano"
        ColorInstrument = "255,0,0"
    }
    else if Instrument == "Drums"
    {
        IconInstrument = "Drums"
        ColorInstrument = "0,255,0"
    }
    else if Instrument == "Saxophone"
    {
        IconInstrument = "Saxophone"
        ColorInstrument = "0,0,255"
    }
    else
    {
        IconInstrument = " "
        ColorInstrument = "0,0,0"
    }
    aMusician.SetAttributeString( "Instrument", Instrument )
    aMusician.SetAttributeString( "Instrument_Icon", IconInstrument )
    aMusician.SetAttributeString( "Instrument_BackgroundColor", ColorInstrument )
    aMusician.SetAttributeString( "Instrument_TextColor", TextColorInstrument )

    // Appending this musician (VolatileInstance) to the list plugged to the feature chooser.
    lMusicians_as_VolatileInstances.Append( aMusician )    
}