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

  • Protecting business operations means shifting the priorities around availability from disaster recovery to business continuity. Enterprises are shifting their focus from recovery from a disaster to preventing the disaster in the first place. With this change in mindset, disaster recovery is no longer the first line of defense; the organizations with a smarter business continuity practice are less impacted when disasters strike. This SmartSelect will provide insight to help guide your enterprise toward better …

  • Live Event Date: August 14, 2014 @ 2:00 p.m. ET / 11:00 a.m. PT Data protection has long been considered "overhead" by many organizations in the past, many chalking it up to an insurance policy or an extended warranty you may never use. The realities of today make data protection a must-have, as we live in a data driven society. The digital assets we create, share, and collaborate with others on must be managed and protected for many purposes. Check out this upcoming eSeminar and join eVault Chief Technology …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds