The IndicatorWidget component use is similar to the one of the Widget component.
But properties, allowing simple receiving of the current value of one of the instrument sliders, are added in the IndicatorWidget.
The Value property and the ValueChanged event are added in the IndicatorWidget. They correspond to the Value property and ValueChanged event of one of the instrument sliders used in the IndicatorWidget. In order to assign the exploitable slider, its name is assigned in the SliderName property.
Besides, the IndicatorWidget allows moving a specified slider automatically by means of the keyboard.
The shift step is assigned in the Increment property.
It is possible to change values range for the selected slider scale using the Minimum and Maximum properties.
Please, pay special attention to the fact that all above-listed properties have no meaning until the instrument or the desired instrument slider’s name for the IndicatorWidget is assigned. If the instrument is assigned, it is more convenient to assign the name of the used slider with the pulldown use in the SliderName property. The names of all instrument sliders are displayed in the list.
Let’s consider the IndicatorWidget use by the example.
Create WindowsForms application with one form. Put the IndicatorWidget component on the form.
The instrument designer is invoked by the mouse double click on the component. In the invoked designer, let’s open the existing instrument with the help of the SharpShooter Gauges Wizard. For example, open SparkleBlueCircle.
Confirm the changes by clicking the “OK” button. The selected instrument will be displayed in the IndicatorWidget component.
Run the application to check the instrument availability.
Put the Label component on the form for displaying the current control elements value as text. In order to have access to the slider value let’s assign the SliderName property in Slider1.
Let’s realize the ValueChanged event handler in the following way:
private void indicatorWidget1_ValueChanged
object sender, PerpetuumSoft.Framework.Model.PropertyEventArgs args)
"Current Value = " + indicatorWidget1.Value.ToString("0.00");
Program work result:
The access to the current slider value is simplified (compare with the similar example of the Widget component use).
So, if you need the access to the current slider value of the instrument slider, it is preferable to use the IndicatorWidget.
Now change the scale range, within which the slider is moving, with the help of the Minimum and Maximum properties. Set the Maximum value to 50.
For the convenience of changing slider value from the key board, set the Increment property value to 10. Now if you press the “Left” or “Down” buttons, the slider value will be decreased by 10, if you press the “Right” or “Up” buttons, the slider value will be increased by 10.
As the IndicatorWidget is inherited from the Widget, you can use such properties as: ZoomScale, HideFocusRectangle, InvalidateInterval.