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: September 16, 2014 @ 11:00 a.m. ET / 8:00 a.m. PT Are you starting an on-premise-to-cloud data migration project? Have you thought about how much space you might need for your online platform or how to handle data that might be related to users who no longer exist? If these questions or any other concerns have been plaguing you about your migration project, check out this eSeminar. Join our speakers Betsy Bilhorn, VP, Product Management at Scribe, Mike Virnig, PowerSucess Manager and Michele …

  • This ESG study by Mark Peters evaluated a common industry-standard disk VTl deduplication system (with 15:1 reduction ratio) versus a tape library with LTO-5, drives with full nightly backups, over a five-year period.  The scenarios included replicated systems and offsite tape vaults.  In all circumstances, the TCO for VTL with deduplication ranged from about 2 to 4 times more expensive than the LTO-5 tape library TCO. The paper shares recent ESG research and lots more. 

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds