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

  • IBM Worklight is a mobile application development platform that lets you extend your business to mobile devices. It is designed to provide an open, comprehensive platform to build, run and manage HTML5, hybrid and native mobile apps.

  • On-demand Event Event Date: October 23, 2014 Despite the current "virtualize everything" mentality, there are advantages to utilizing physical hardware for certain tasks. This is especially true for backups. In many cases, it is clearly in an organization's best interest to make use of physical, purpose-built backup appliances rather than relying on virtual backup software (VBA - Virtual Backup Appliances). Join us for this webcast to learn why physical appliances are preferable to virtual backup appliances, …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds