Home Page > Programming Samples and Tutorials > C++ Samples > User Data
VC UserData Sample
User Data C++ Sample
Overview
Implementation
All activity starts with the CUserDataDlg::UpdateModelInfo(), which is called
either on start of the application or on load of a new model. In this function IDataSource
is queried from IModel. Existence of the data table
in the model is checked with IDataSource.GetTable.
If the table exists its IData interface is acquired
and stored in _iTableData variable. Otherwise the table is created in
CUserDataDlg::CreateTable(), where the three fields described above are added.
Newly created table is populated than with records one per each object in the
model. It is done. in CUserDataDlg::CreateRecords() function using IRecordSet.InsertRecordAt
and IDataMods interface.
An individual record is displayed on changes of selection in the list box in
UpdateObjectInfo() and DisplayDataBaseObjectInfo() functions using IData
and IUserData interface.
OnEnter() handler looks up the selected object in the Flat Object Array
and uses the index as key (the first field) into the data base to modify the
record with calls to IDataMods.SetStringAt
and IDataMods.SetDoubleAt
methods.
Commands of the Raw Data menu are handled by CUserDataDlg::OnRawDataLoad(),
CUserDataDlg::OnRawSaveAs() and
CUserDataDlg::OnRawDataDelete() handlers as described in
Unformatted User Data
Stream topic
See also User Data, Visual Basic Samples,
All samples
|