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

  • Webinar on September 23, 2014, 2 p.m. ET / 11 a.m. PT Mobile commerce presents an array of opportunities for any business -- from connecting with your customers through mobile apps to enriching operations with mobile enterprise solutions. Join guest speaker, Michael Facemire, Forrester Research, Inc. Principal Analyst, as he discusses the new demands of mobile engagement and how application program interfaces (APIs) play a crucial role. Check out this upcoming webinar to learn about the new set of …

  • On-demand Event Event Date: September 10, 2014 Modern mobile applications connect systems-of-engagement (mobile apps) with systems-of-record (traditional IT) to deliver new and innovative business value. But the lifecycle for development of mobile apps is also new and different. Emerging trends in mobile development call for faster delivery of incremental features, coupled with feedback from the users of the app "in the wild." This loop of continuous delivery and continuous feedback is how the best mobile …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds