PowerBuilder Trackbar; reinvented (also introducing a new Rangebar control)
Out of the box, PowerBuilder comes with a very usable horizontal and vertical trackbar. It works as advertised; your users can move the slider to select a value that falls within a predefined Min and Max value range. Very simple.
When developing the Image Editor control for Ultimate Suite; a major limitation was discovered with the PowerBuilder Trackbar. I needed a way for users to select the brightness or contrast for an image. It seemed logical to use a trackbar for this. For example, we have a min and max brightness and we need the user to select a value in that range.
After placing the trackbar on the image editor control the first thing that I had to do was change the controls background color so that it matches the color scheme I was using. But... to my surprise, there is no background color property for the trackbar. This seemed odd seeing that most controls in PowerBuilder have a background color option.
Some research was done to see if there was an API I could hit to change this but there was nothing available. This is most likely the reason why PowerBuilder doesn't provide a background color option for this control.
Great! The only other option was to develop the trackbar from scratch. It never occurred to me that Ultimate Suite would need to have a trackbar control but this seemed like a big enough limitation where developing one might be useful to other developers.
After playing around with the native trackbar I noticed a few things. First, no colors can be customized. This included the center line, the slider, tick marks, or the "tracked line" (this is the line from the min position to the edge of the slider). Second, the slider couldn't be customized. You had a choice between a rectangle or a rectangle with a point. This was determined by where the tick marks display, so no control on that front either. Third, you can't set the size of the line and the size of the slider independently from one another.
The Ultimate Suite Trackbar (PowerTrackbar), overcomes all these limitations. Nearly every component is customizable.
The slider can be a square (rectangle), circle (oval), or an image of your choice. The slider size is adjustable, this includes both the width and height. The line size can be adjusted independently from the slider. The control supports both Horizontal and Vertical orientations (in one control).
After everything was developed, it seemed logical that a developer would want the ability to select a range instead of a single value. Adding this functionality to PowerTrackbar would have made it to complicated for the purpose that it has so, a new control was created; PowerRangebar.
The PowerRangebar control has all the same features as PowerTrackbar but with a few extras. You can select a start and end value and move the selection back and forth with the mouse.
Both the PowerTrackbar and PowerRangebar controls will be released with the next version of Ultimate Suite for PowerBuilder. If all goes as planed, this will be late March or early April.
For more information about Ultimate Suite, visit PBUltimateSuite.com.