Slider Button Control

Synopsis

I was developing an image editor and found my dialog boxes cluttered with edit boxes, spin buttons and sliders. I thought the slider edit box that Adobe Photoshop had was cool and saves spaces. I decided to make my own, and so, here is my Slider Button Control. The code was based on several examples I found in codeguru. Thanks to all those guys.

Using the Control

The control consists of four files, they are:

  • wcSliderButton.h
  • wcSliderButton.cpp
  • wcSliderPopup.h
  • wcSliderPopup.cpp

To use the control, you will only need to include wcSliderButton.h in your header file.

Step 1 :

Include "wcSliderButton.h" in your dialog's header file. Add an Edit Box to your dialog box and change it to wcSliderButton instead of CEdit..

Step 2 :

Replace the DDX_Control in the DoDataExchange() to DDX_SliderButtonCtrl(pDX, IDC_EDIT1, m_SliderEdit, 0); The fourth parameter determines where the drop arrow button in the edit box will be placed. 0 Right and 1 Left. Note that by having DDX_SliderButtonCtrl in the DoDataExchange, the compiler will complains whenever you invoke the Class Wizard. I haven't any solution to come around this yet. Changes to the edit box can be detected as normal CEdit using ON_EN_CHANGE. 

Downloads

Download demo project - 39 Kb
Download source - 9 Kb


Comments

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Live Event Date: December 11, 2014 @ 1:00 p.m. ET / 10:00 a.m. PT Market pressures to move more quickly and develop innovative applications are forcing organizations to rethink how they develop and release applications. The combination of public clouds and physical back-end infrastructures are a means to get applications out faster. However, these hybrid solutions complicate DevOps adoption, with application delivery pipelines that span across complex hybrid cloud and non-cloud environments. Check out this …

  • CentreCorp is a fully integrated and diversified property management and real estate service company, specializing in the "shopping center" segment, and is one of the premier retail service providers in North America. Company executives travel a great deal, carrying a number of traveling laptops with critical current business data, and no easy way to back up to the network outside the office. Read this case study to learn how CentreCorp implemented a suite of business continuity services that included …

Most Popular Programming Stories

More for Developers

RSS Feeds