Periodically, programmers encounter situations where they want to embed a pre-existing C++ control into the grid. It could be an MFC control or a custom control they wrote from scratch. The following tutorial tells you how to create a grid control from a CSliderCtrl.
The grid control (
CGXSliderCtrl) is created by multiply inheriting from
CGXControl and
CSliderCtrl and overriding the key virtual functions in
CGXControl. Also, following the control-sharing paradigm of the grid architecture you need to map all the necessary data attributes of the
CSliderCtrl (such as range and position) to appropriate cell style’s attributes. In this tutorial the position of the slider is stored as the value attribute in the style and the minimum and maximum positions are stored as custom user attributes in the style. If you need to use more attributes of the
CSliderCtrl, then you could create more custom user attributes to store their values in the style. The tutorial assumes that you are familiar with the control architecture of the grid as explained in
Chapter 2, “Design Overview.”