The DDX_FieldSlider function synchronizes the thumb position of a slider control in a record view and an int field data member of a recordset associated with the record view (or with whatever integer variable you choose to map it to).
void AFXAPI DDX_FieldSlider( CDataExchange* pDX, int nIDC, int& value, CRecordset* pRecordset ); void AFXAPI DDX_FieldSlider( CDataExchange* pDX, int nIDC, int& value, CDaoRecordset* pRecordset );
- A pointer to a CDataExchange object. The framework supplies this object to establish the context of the data exchange, including its direction.
- The resource ID of the slider control.
- A reference to the value to be exchanged. This parameter holds or will be used to set the slider control's current thumb position.
- A pointer to the associated CRecordset or CDaoRecordset object with which data is exchanged.
When moving data from the recordset to the slider, this function sets the position of the slider to the value specified in value. On a transfer from the recordset to the control, if the recordset field is Null, the slider control's position is set to 0. On a transfer from the control to the recordset, if the control is empty, the value of the recordset field is 0.
DDX_FieldSlider does not exchange range information with slider controls capable of setting a range rather than simply a position.
Use the first override of the function if you are working with the ODBC-based classes. Use the second override with the DAO-based classes.
For more information about DDX, see Dialog Data Exchange and Validation. For examples and more information about DDX for CRecordView and CDaoRecordView fields, see Record Views. For information about slider controls, see Using CSliderCtrl.
See DDX_FieldText for a general DDX_Field example. Calls to DDX_FieldSlider would be similar.