Next you add a slider object to the window. A slider visually represents an INTEGER value within some range. In this case, you just make the slider show the same value as the Average Discount field, but as a percentage between 0 and 50.

To define a slider:

  1. Select the Slider icon from the Palette.
  2. Drop it onto the design window to the right of the Average Discount field.
  3. Change the Object name to iDiscPct. You see that the Label field is not enabled for the slider because a slider cannot have a label.
  4. Go into the property sheet for the slider and change the attribute values, as described in the following table:
    Table 1. iDiscPct attribute values
    Attribute Change value to . . . Description
    Max Value 50 Shows values in the range from 0 to 50
    Tic Marks Top/Left Shows tic marks on the top of the slider
    Frequency 5 Shows tic marks every 5 units
    Horizontal true Displays the slider horizontally instead of

    vertically

    Enable false Prevents the user from manipulating the

    slider object

    When you finish, the property sheet should look like this:

  5. Click OK after making these changes.
  6. You want the slider value to display along with the other extra fields at the bottom of the window each time the user selects a browse row, so edit the VALUE-CHANGED trigger for the browse and replace the line that assigns the dAvgDisc field and the DISPLAY statement that follows it with these lines:
    ASSIGN dAvgDisc = (dTotalPrice - dTotalExt) / dTotalPrice
      iDiscPct = dAvgDisc * 100.
    DISPLAY dTotalPrice dTotalExt dAvgDisc iDiscPct cWorstWH cBestWH
     
      WITH FRAME CustQuery.
  7. You can make the slider tall enough to show the percentage value above the slider itself, or shrink it down vertically so that it just shows the slider itself. It should show the same value as the Average Discount field it is next to:

Look at the code for a slider

Here is the AppBuilder-generated code for the slider:

DEFINE VARIABLE iDiscPct AS INTEGER INITIAL 0 
     VIEW-AS SLIDER MIN-VALUE 0 MAX-VALUE 50 HORIZONTAL 
     TIC-MARKS TOP FREQUENCY 5
     SIZE 26 BY 1.19 NO-UNDO.