Navigation: Ultimate Suite for PowerBuilder Help > Datawindow Controls >

Rating Stars

Send comments on this topic.

 

Rating Stars

Displays rating stars. The stars size, color, and value are all dynamic which makes it a better solution than using images.

Function Parameters

f_pbus_rating (unsignedlong ahdc, long ax, long ay, long awidth, long aheight, double currentvalue, integer maxvalue, string theme)

Argument

 Description

 ahdc

 Always pass GetPaintDC() in the DW Expression

 ax

 Always pass GetPaintRectX() in the DW Expression

 ay

 Always pass GetPaintRectY() in the DW Expression

 awidth

 Always pass GetPaintRectWidh() in the DW Expression

 aheight

 Always pass GetPaintRectHeight() in the DW Expression

 currentvalue

 The star rating value. This value is relative to the MaxValue parameter. If MaxValue is 5, then CurrentValue can be any value between 0 and 5.

 maxvalue

 The max star rating value. This will determine the number of stars to display.

 theme

 Pass, as a string, the color of the circle. Valid values are "BLUE", "OLIVE", "SILVER", "BLACK", "CLASSIC", "PINK", "DEEPBLUE", "PURPLE", "GREEN", "ORANGE", "RED"

Implementation

This control is rendered in a computed field on your dataobject. Start by adding a computed field to your datawindow and give it the width and height that you want. Add an expression to the computed field that will look like this:

Paint
(
    if (f_pbus_rating(GetPaintDC(),
                      GetPaintRectX(),
                      GetPaintRectY(),
                      GetPaintRectWidth(),
                      GetPaintRectHeight(),
                      employee_cust_rating,
                      5,
                      "BLUE")
    , "", "Error")
)

The employee_cust_rating in this example is a field on the datawindow. Change this value. You can use a column, computed field, or hard coded value. This example will display "5" stars. Change this value in the expression to display more or less.

Previewing Your Rating Control

The star rating control will not render in the painter portion of the datawindow painter. It will display in the preview section of the datawindow painter. To see the control in design time, open the preview panel in the datawindow painter and retrieve a row.


Copyright © 2021 Werysoft Inc.