Control Description
scaHalfStarRating User Control gives you the possibility to add a Star Rating based rank to your site.
Features
- Allow half stars
- Clear button (optional)
- Stars Quantity
- Catch the following events: Mouse over, mouse out, Clear button pressed
Compatibility
Web
Using the control
This is a Control Type User Control (which is not displayed in the toolbox) as FCK Editor User Control, you will need to select this User control in the Control Type property of the control.
Drag an drop a numerical variable and change the property value "ControlType" to "scaHalfStarRating".
You can catch the MouseOver, MouseOut, Click and Cancel events and do what you need using native GeneXus events.
Properties
- Stars: Indicates the number of starts (5 by default)
- HalfStar: true/false, indicates if uses half star or entire star.
- ClearButton: Allows to show/hide the Clear Button (clears the selected value)
Example :
Create a variable &rate, N(4,0)
Insert this variable in the webform
Select "scaHalfStarRating" in the ControlType property
Now, the user control is ready to use!
Below you will find a sample code.
Events
Event &rate.MouseOver
&value = &rate.MouseOverValue
Do 'ChangeText'
EndEvent
Event &rate.MouseOut
if &rate=0
DescTextBlock.Caption = ""
else
&value = &rate
Do 'ChangeText'
endif
EndEvent
Event &rate.Click
&value = &rate
Do 'ChangeText'
EndEvent
Event &rate.Clear
DescTextBlock.Caption = ""
EndEvent
Sub 'ChangeText'
Do case
case &value = 10
DescTextBlock.Caption = "Excellent"
case &value = 9
DescTextBlock.Caption = "Very good"
case &value = 8
DescTextBlock.Caption = "Good"
case &value = 7
DescTextBlock.Caption = "Acceptable"
case &value = 5 or &value = 6
DescTextBlock.Caption = "Regular"
case &value = 3 or &value = 4
DescTextBlock.Caption = "Poor"
case &value = 1 or &value = 2
DescTextBlock.Caption = "Very poor"
endcase
EndSub