Enhanced Multislider Control

Sample Image

Environment: Developed with VC++6 SP3, tested on NT4 SP3, Win9x and Win2K (see below)

The slider control described in this article is an extension of the cute CMultislider control by Terry Braxton. Here is a list of the enhancements I introduced:
  1. Full support to multiple layout:
    • Horizontal and vertical orientation
    • Markers' arrows may point both top/left and bottom/right (this works fine, only some tiny graphical flaws were noticed occasionally on some platforms - especially Win2K. Any fix is welcome!).
    • Possibility of inverting ranges (from left to right and viceversa and top-down or viceversa). I introduced this because I needed a vertical Slider, and it looked better going upwards, while the default was the opposite.
    • The control works fine (graphic is OK) for any reasonable size.
  2. Markers that are dragged outside the control may disappear (behaviour on original control) or simply stop at the end of the sliding channel.

  3. Markers in original control may overcross (?) so that you could drag the leftmost to become the rightmost and viceversa. I found little use of this for my purpouses - to say it all, I wanted to avoid it! Now such a behaviour is configurable.

  4. Original control had two cool right-click effects: change of intervals colors (cliccking on intervals) and setting of exact position of a marker (cliccking on the marker itself). Now you can decide what the user can or can't do.

  5. I found the focus rect disturbing in my application. You can remove it setting an apposite flag.

  6. A notification mechanism
  7. is set, so that parent window knows when the user modifies position of a marker in the control.

To set all of these features (excluded orientation, which must be decided in the usual way), all you need is to pass a suitable mask to Init function, together with usual parameters (Min and Max ranges, number of ticks, number of markers, list of colors...)

 int LayOut = MLTSLD_DISPLAY_VALUES | MLTSLD_DISPLAY_TOOLTIPS |
               MLTSLD_PREVENT_CROSSING | MLTSLD_ALLOW_SET_POS;
      for (int j=0; j<SLIDERS_NUM; j++)
	      m_Slider[j].Init(min, max, 10, m_NumMarkers, NULL, colors, LayOut);  

All that you need is to include few files in your project. See comment in the zip of Demo project for more info.

Downloads

Download demo project - 51 Kb
Download executable - 511 Kb


Comments

  • Good Control but require some enhancement

    Posted by Legacy on 07/29/2002 12:00am

    Originally posted by: Amit

    I think contol is good but if any one can suggest how to change the markers/sliders color then it is very useful to me.

    Reply
  • CMultiSlider Control by Terry Braxton?

    Posted by Legacy on 07/03/2002 12:00am

    Originally posted by: Proferit

    Where can I find this?

    Reply
  • Good Idea, Poorly Written

    Posted by Legacy on 06/08/2001 12:00am

    Originally posted by: Bill

    This version of the Slider Control is a good idea but only from the standpoint of multiple markers and colors.

    The implementation is extremely poor and the tooltip implementation from the days of DOS. The Windows version of the Slider Control already supports tooltips and it should be used.

    This control must also support user click in the slider rect to move the marker or it is next to useless (a user would first attempt to quickly move the marker by clicking in a relative position and expect the marker to move to it like the normal Windows Slider Control.) But this is not implemented.

    I must thank the author for a very good start. Somebody else should be able to take this and run with it, to bring it to a quality implementation.

    If I have time, I may do this myself.

    Best Regards,

    Bill

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

Top White Papers and Webcasts

  • Live Event Date: October 29, 2014 @ 11:00 a.m. ET / 8:00 a.m. PT Are you interested in building a cognitive application using the power of IBM Watson? Need a platform that provides speed and ease for rapidly deploying this application? Join Chris Madison, Watson Solution Architect, as he walks through the process of building a Watson powered application on IBM Bluemix. Chris will talk about the new Watson Services just released on IBM bluemix, but more importantly he will do a step by step cognitive …

  • 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