?? readme.txt
字號:
In order to avoid repetition, we don't reference methods and
properties of the core components that are documented in the DAO reference.
Only those functions with extended functionality are mentioned. You can
browse header files for more information.
Core components:
- Field
Field(Recordset&, Variant);
Constructs a Field object from a Recordset and an index.
- Recordset
static Database* pdbase;
Stores this Recordset's Database pointer.
Recordset(LPCSTR);
Constructs a Recordset object from a SQL string
Recordset(CString const &);
Idem, taking a CString. It allows formatting and concatenating.
FieldValue[Variant];
Retrieves or stores field data given an index.
- Database
static DBEngine* pdbeng;
Stores this Database's DBEngine pointer.
Database(LPCSTR, LONG = 0, BOOL = FALSE, LPCSTR = NULL);
Constructs a Database object from its file path.
- DBEngine
DBEngine();
Initializes COM and constructs a DBEngine object.
- Parameter
Parameter(QueryDef&, Variant);
Constructs a Parameter objects from a QueryDef and an index.
- QueryDef
QueryDef(Database*, LPCSTR);
QueryDef(Database*, CString const &);
Constructs a QueryDef object from a Database and a name.
QueryDef(LPCSTR);
QueryDef(CString const &);
Constructs a QueryDef object from the current Database and a name.
Parameter Parameters[Variant];
References a Parameter from the Parameters collection.
- Globals
Variant getdate();
Retrieves current date/time
CString shortdate(Variant);
Returns date part
Variant GetField(CString select, CString from, CString where, Variant value);
Returns data from a field using 'pseudo' SQL
Abstract base classes:
- DaoWindow
DaoWindow(LPCSTR s = 0, bool a = false);
Regular constructor. It takes a SQL string and an editing/adding condition.
DaoWindow(Recordset& r, bool a = false);
Constructor for child objects, taking an existing recordset.
bool alta;
Attribute that determines if we are editing or adding a record.
virtual bool Execute() = 0;
Mandatory execution method.
virtual bool Exec(char* sql, bool a = false);
This method launches a dialog object from an external user interface.
virtual bool Baja(char* sql);
Method for managing record deletion
- DaoControl
virtual void Transfer(BOOL bSaveAndValidate) = 0;
This forces derived classes to implement the transfer mechanism.
Variant index;
Attribute for the field class. It can be a field name or a field index.
void DDX_Control(CDataExchange *pDX);
Binding method. It manages collaboration between the GUI and database
components.
DaoControl& operator=(Variant const &);
Assignment operator. Each derived class must override this.
virtual void Enable(bool e = true) = 0;
User interface enabling/disabling mandatory method.
Windowing user interface:
- CDaoDialog
This class combines a regular CDialog with a DaoWindow interface. It
trasparently manages several aspects of the user interface, such as
initialization of control objects, enabling of controls, update or insert of
data and control navigation.
bool cont;
Attribute for controlling survival of the object after an OnOK event.
Useful for continued data entry.
bool child;
This condition is true if the object was created with the child
creation constructor.
CDaoDialog(UINT i, CWnd* p = 0, LPCSTR s = 0, bool a = false);
Normal constructor. It takes the usual CDialog parameters plus a SQL
string and a insert/update flag.
CDaoDialog(UINT i, Recordset& r, CWnd* p = 0, bool a = false);
Child creation constructor. It references an existing Recordset
object.
virtual void OnOK();
It manages inserting or updating data.
void SetCaption(LPCTSTR str);
As name suggests.
bool Execute();
Virtual execution member function. Returns true if OK is pressed;
false otherwise.
void SetModify(int Id, bool mod = true);
Helper function for edit controls.
void SetDlgItemText(int nID, LPCTSTR lpszString);
Override of the CWnd function. It sets the modify flag in edit
controls.
virtual void OnModificar();
Manages enabling of controls.
virtual void OnEnter();
Moves focus among controls on each return.
- CDaoPropSheet
Objects of this class, unlike CDaoDialog, can be used directly. It
adapts the functionality of CDaoDialog to property sheets.
CDaoPropSheet(LPCTSTR pszCaption = 0, LPCSTR s = 0, bool a = false,
CWnd* pParentWnd = NULL);
Constructor. Takes the normal CDaoPropertySheet parameters plus a SQL
string and an insert/update flag.
bool modif;
Modification flag. It determines enabling of controls.
bool Execute();
Virtual execution method. Returns true if OK is pressed;
false otherwise.
- CDaoPropPage
This is a base class for property pages linked to CDaoPropSheet
objects. In addition to the regular CDaoDialog features, it manages wizard
interfaces for inserting new data.
CDaoPropPage(UINT resId);
Constructor. It takes a resource identification.
bool GetModif() const;
It returns the property sheet modification flag.
void SetModify(int Id,bool mod = true);
Helper function for edit controls.
bool GetAlta() const;
It returns the insert/update flag.
virtual void OnModificar();
Manages enabling of controls.
Control components:
- CDaoCheck
This control binds to a checkbox and a boolean data field.
CDaoCheck& operator=(Variant const & v);
Initialization method. It associates the Field object with an index.
void Enable(bool e = true);
User interface enabling function.
friend void AFXAPI DDX_Control(CDataExchange* pDX, int nIDC, CDaoCheck& rControl);
This global function overrides the regular DDX_Control function for
this kind of control.
- CDaoCombo
This is a more complicated control: it manages a combo box related to
a recordset, usually from another table (lookup). It binds to an integer data
field in the master table.
void Init(Variant v, LPCSTR s);
Initialization function. It takes an index for the Field component
and a SQL string for the Recordset component.
void Enable(bool e = true);
User interface enabling function.
bool Disabled;
Setting this property disables the component.
friend void AFXAPI DDX_Control(CDataExchange* pDX, int nIDC, CDaoCombo& rControl);
This global function overrides the regular DDX_Control function for
this kind of control.
- CDaoEdit
This control binds to an edit control and a data field of any type.
Data type conversion is made transparently.
CDaoEdit& operator=(Variant const &);
Initialization method. It associates the Field object with an index.
void Enable(bool e = true);
User interface enabling function.
bool ReadOnly;
Setting this property avoids writing to the component.
friend void AFXAPI DDX_Control(CDataExchange* pDX, int nIDC, CDaoEdit& rControl);
This global function overrides the regular DDX_Control function for
this kind of control.
- CDaoGroup
This control binds to a group of automatic radio buttons and an integer
data field.
CDaoGroup& operator=(Variant const & v);
Initialization method. It associates the Field object with an index.
void Enable(bool e = true);
User interface enabling function.
friend void AFXAPI DDX_Control(CDataExchange* pDX, int nIDC, CDaoGroup& rControl);
This global function overrides the regular DDX_Control function for
this kind of control.
- CDaoRadio
This is a simpler control, managing two auto radio buttons and binding
to a boolean data field.
CDaoRadio& operator=(Variant const & v);
Initialization method. It associates the Field object with an index.
void Enable(bool e = true);
User interface enabling function.
friend void AFXAPI DDX_Control(CDataExchange* pDX, int nIDC, CDaoRadio& rControl);
This global function overrides the regular DDX_Control function for
this kind of control.
- CDaoListCtrl
This control binds to a list control and a Recordset. In addition, it
provides custom test drawing and interfacing to dialogs and property sheets
for adding and editing data.
CDaoListCtrl(Recordset& r);
Constructor taking a Recordset reference.
int Llenar();
Filling function.
void Linea(int index);
This function takes care of filling each row.
LPCSTR GetIndexText(int index);
This retrieves the text of an item given its index.
int Update(int index);
Updating function.
Complete components:
- CListDialog
This dialog-based class displays the contents of an entire Recordset.
It formats columns according to the fields of the recordset.
CListDialog(Recordset& r, DaoWindow* d = 0, CWnd* pParent = NULL);
Constructor. It takes a Recordset reference and an optional DaoWindow
descendant, which it can open for inserting or modifying data.
void SetCaption(LPCSTR str);
As name suggest.
int* lencol;
Optional array of column lengths, for custom formatting.
int indcol;
Optional index for the column used in the WHERE clause of the SQL
statement.
int* totcol;
Optional array of column indexes. The component computes totals on
these columns and show them at the bottom of the list, in each corresponding
column.
CDaoListCtrl m_Lista;
The CDaoListCtrl member.
virtual void OnOK();
If a DaoWindow descendant was specified on construction, the
component builds a SQL statement for the selected row and executes the dialog
object.
afx_msg void OnImprimir();
Prints the content of the list control.
Macros:
DAOCONTROL(fieldname)
Initializes the control object. It is included normally in the window
object's constructor.
DAOCOMBO(fieldname, tablename)
Initializes a DaoCombo object. It takes as arguments the field name
in the master table and the lookup table name.
Buenos Aires, December 1998.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -