MFC Step-by-Step Guide

Tutorial 6

SliderCtrlWithEcho class


GOAL: Improve our knowledge from previous classes and define/customize a new GUI element class, allowing increasing ability to read and maintain our system
PREREQUISITES: Tutorial 3 and the 'SliderCtrlWithEcho' class added to the project

Learn and Use 'SliderCtrlWithEcho' class
  1. In 'TutorialDlg.h', add #include "SliderCtrlWithEcho.h" to the top
  2. Re-compile 'StdAfx.cpp', to update the pre-compile header.
  3. Add a Slider Control to the dialog window, inside the Properties window, change
    1. Orientation to "Vertical" or "Horizontal"
  4. Add an output Control Variable to the slider, with
    1. Category to Control
    2. Variable Name to "m_SliderBar"
    3. Variable Type to CSliderCtrlWithEcho
  5. In 'Tutorial.cpp', inside OnInitDialog(), add
       // Initialize the slider bar with
       // specific range and starting position
       m_SliderBar.Initialize(0.0f, 100.0f, 1.0f);
  6. In 'Tutorial.cpp', inside OnTimer(...), you may add
       // to retrieve slider position
       float slideValue = m_SliderBar.GetSliderValue();
       // and to set slider position
       m_SliderBar.SetSliderValue(slideValue);
       UpdateData(FALSE);


» Written by William Frankhouser (wjf2@washington.edu)
» Advised by Kelvin Sung (ksung@washington.edu) as part of the project sponsored by the National Science Foundation under Grant No. 0442420. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation.
» Produced in the "Essential Concepts for Building Interactive Computer Graphics Applications", A.K. Peters, Ltd.