Jump to content
JohnLM

Is there a Trackbar that has two sliders?

Recommended Posts

I was wondering if there is a trackbar with two sliders, so that I can use as a min/max setting--i.e., for making text selection ranges.  I am not qualified to extend upon the built-in version that comes with Delphi, let alone build one from scratch as a new component. 

 

1st method:

I have often come into idea situations with I wish Delphi has one.  Today, I had an idea about creating a string utility app to parse strings with (integer) parameters and thought that entering numbers would be a tad bit tedious and then I came up with a trackbar idea, where I build a list of start/end or min/max range and have the app give me the actual position and length position(s) for their values for the string "ABC 123 DEF 456 7GH8 IJKL9".

 

And, given the TrackBarEx below:


140648576_im-praxis-trackbarwithtwosliders.png.3fb24c03035097ff81bc756ca7f50c24.png

 

with the following parameters: TrackBarEx(min=5, max=3) and using those two values, calculate the string to be "123".

 

The trackbarex would return two values, the starting and ending position for the string, per user control. 

 

The above is a crude way of explaining what I am trying to do.   It may not be as clear or accurate.  I would have to calculate the position and distance in the string to get the values of the string position(s) and put those values in a list for me to parse out the string bits.  Thus, the following layout of the string, using the trackbarex, I would parse out each of the six text string positions in a list: 

 

         1         2         3
123456789012345678901234567890
ABC 123 DEF 456 7GH8 IJKL9

 

and the returned values would be: 

 1, 3  ABC
 5, 7  123
 9,11  DEF
13,15  456
17,20  7GH8
22,26  IJKL9

NOTE:  in the above example, the strings "ABC" through "IJKL9" would not be returned. I am just showing that for visual/aesthetics purposes. 

 

The trackbarex would contain two sliders and have a minval and maxval that are returned. Not that they are returned but that they are the values of each of the sliders as the user moves them.  I would just take those two values and use those to calculate the position within the string. 

 

2nd/alternate method: 

For now, I have an other method that I am working on right now in hopes to produce the same idea by using one standard TrackBar and a SpinEdit and I would manually set the length of the string to capture every time I move the trackbar to a position.  Thus, move trackbar to position 1, set the spinedit to 3, calculate the string and parse it to "ABC".  Rinse and repeat for "123", thus move trackbar to position 5, set the spinedit to 3, calculate the string and parse it to "123".., rinse and repeat, . . . and so on. 

 

 

Edited by JohnLM
typos and corrections

Share this post


Link to post
8 minutes ago, JohnLM said:

I was wondering if there is a trackbar with two slider

Not natively, no. But I'm sure a 3rd party one exists if you search around.

Share this post


Link to post

I just made some edits to the topic.  

 

I did not complete this post.  I pressed the [submit] button too quicky.  Anyway.  

 

In the 2nd method, I have the trackbar and spinedit controls.  And below that, I have an editbox also, and below that, two memo's, one for the the strings and another for the value pairs to use in parsing out the strings.  And then, I have [Add] and [Del] buttons.

 

I am designing the app to show in real-time, the text I am selecting via the trackbar and spinedit so that I can see the values I need. The real-time feedback will help to show me what I am selecting. 

 

If I can get a working demo, I will post it up here.  It might be useful in some way or idea for others. 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×