Data Access User Manual > Rogue Wave Views Data Access Common Framework > Tables > Table Properties > Property-Aware Gadgets
 
Property-Aware Gadgets
Data-source-aware gadgets can be sensitive to given properties. Each gadget specifies the property names to which it is sensitive and what values are expected for these properties. It is then possible to change the behavior or look of the gadget by changing the property value of the table part to which the gadget is connected.
As a consequence, if a given table part is simultaneously displayed through different gadgets, some of its graphical attributes (for example, the font or the color) will automatically be identical in all gadgets. The application code that decides of the color needs only assign the “font” property to that part. It does not need to know in which gadgets that part is displayed nor does it need to access these gadgets and call member functions specific to them.
In addition, a property-aware gadget can use a different property manager than the default property manager of the table on demand.
Currently, the following gadgets are property-aware:
*IliTableGadget
*IliDbField
*IliEntryField
*IliDbText
*IliTableComboBox
*IliDbStringList
*IliToggleSelector
*IliDbToggle
*IliDbOptionMenu
These gadgets support the following properties (when applicable):
Property Name
Property Value Type
Property Value
font
String
font name
background
String
color name
foreground
String
color name
readOnly
Boolean
1 or 0
format
String
format name or specification
mask
String
mask name or specification
The following code example shows how table properties are used:
void MakePrimaryColumnsReadOnly(IliTable* table) {
IlvInt count = table->getColumnsCount();
const IlInt allRows = -1;
const IlInt allColumns = -1;
const IlInt insertRow = -2;
const IlvSymbol* readOnlyName = IlvGetSymbol("readOnly");
IliValue trueVal = (IlInt)1;
IliValue falseVal = (IlInt)0;
 
for (IlInt colno = 0; colno < count; ++colno) {
if (table->isColumnPartOfKey(colno)) {
table->setProperty(allRows,
colno,
readOnlyName,
trueVal);
}
}
table->setProperty(insertRow,
allColumns,
readOnlyName,
falseVal);
}
Note that a value of -2 can be used for the row index to designate the insertion row.
The MakePrimaryColumnsReadOnly function in the previous example works for the following reason. Since rows have precedence over columns, the readOnly property will be false for all cells contained in the insertion row (whatever the column), whereas it will be true for all primary key column cells contained in other rows.

Version 6.0
Copyright © 2015, Rogue Wave Software, Inc. All Rights Reserved.