Data Access User Manual > Rogue Wave Views Data Access Common Framework > Data Sources and Gadgets > Data Sources > Creating a Data Source Gadget
 
Creating a Data Source Gadget
A data source is a gadget that manages an IliTable object. The following code sample shows how a data source can be created and set up to manage a memory table:
IlvDisplay* display;
IlvGadgetContainer* panel;
...
// Create a data source gadget.
IliDataSource* ds = new IliDataSource(display,
IlvPoint(10, 10));
 
// Create and define a memory-table.
IliMemoryTable* tbl = new IliMemoryTable(display);
tbl->lock();
tbl->appendColumn(“Id”, IliIntegerType);
tbl->appendColumn(“Name”, IliStringType);
 
// Assign the memory-table to the data source.
ds->setTable(tbl);
tbl->unLock();
 
// Put the data source in a panel.
panel->addObject(ds);
panel->setObjectName(ds, “EMP”);
Data Access provides the following subclasses of the IliDataSource class:
*IliMemoryDataSource—this class instantiates an IliMemoryTable.
*IliSQLDataSource—this class instantiates an IliSQLTable.
The only difference between these two classes and their base class is that they automatically instantiate the corresponding type of table. These two subclasses are provided for convenience, however, the IliDataSource class can manage any type of IliTable object.
Note: Another slight difference between these subclasses and their base classes is that each subclass has a specific bitmap that appears in Rogue Wave Views Studio.

Version 6.3
Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.