This is a migrated thread and some comments may be shown as answers.

No "MouseUp" on "Telerik.WiControls.UI.radTrackBarElement"

3 Answers 40 Views
RibbonBar
This is a migrated thread and some comments may be shown as answers.
Vishal
Top achievements
Rank 1
Vishal asked on 10 Jul 2018, 11:52 AM
Hello Support,

I have implemented a Telerik.WiControls.UI.radTrackBarElement on which a number of actions are performed after the value has changed/changes. 

Now, the value_changed event is fired even if I have my mouse down. Is there a possibility that the actual value changes after I release my mouse button so the trackbar responds much quicker.

3 Answers, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 11 Jul 2018, 10:51 AM
Hello, Vishal,    

By design, the thumb is moved when handling MouseDown. As a result, the value is changed. This logic is at a location that is too deep in the RadTrackBar functionality for any customization to have effect on it. However, you can handle the MouseUp and ValueChanged event and achieve the desired functionality. Here is a sample code snippet. Note that this is just a sample approach and it may not cover all possible cases. Feel free to modify it in a way which suits your requirement best.
public RadForm1()
{
    InitializeComponent();
 
    this.radTrackBar1.MouseUp += radTrackBar1_MouseUp;
    this.radTrackBar1.ValueChanged += radTrackBar1_ValueChanged;
}
 
float lastValue = 0;
float previousValue = 0;
 
private void radTrackBar1_ValueChanged(object sender, EventArgs e)
{
    if (this.radTrackBar1.Value != previousValue)
    {
        lastValue = this.radTrackBar1.Value;
        this.radTrackBar1.Value = previousValue;
    }
}
 
private void radTrackBar1_MouseUp(object sender, MouseEventArgs e)
{
    previousValue = lastValue;
    this.radTrackBar1.Value = lastValue;
}

I hope this information helps. If you have any additional questions, please let me know.  
 
Regards,
Dess
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Vishal
Top achievements
Rank 1
answered on 11 Jul 2018, 11:06 AM

Hi Dess,

Thanks for your response on this, But if you see my question again the functionality i want to achieve will use "Telerik.WinControls.UI.radTrackBarElement". radTrackBar and radTrackbarElement(component of RadRibbon) are different things and i can not use one in another's position.

Kindly let me know if my understanding is wrong or what can be done to achieve "Mouse Up" in Telerik.WinControls.UI.radTrackBarElement

 

Regards

Vishal Kashyap

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 12 Jul 2018, 11:46 AM
Hello, Vishal,    

I would like to note that RadTrackBar contains a RadTrackBarElement in its internal elements hierarchy. You can handle the RadTrackBarElement.ValueChnaged event to manipulate the value. Then, subscribe to the RadTrackBarElement.BodyElement.MouseUp to update the correct value. Here is the modified code snippet relevant for the RadTrackBarElement hosted in RadRibbonBar:

public RadForm1()
{
    InitializeComponent();
 
    this.radTrackBarElement1.BodyElement.MouseUp += radTrackBarElement1_MouseUp;
    this.radTrackBarElement1.ValueChanged += radTrackBarElement1_ValueChanged;
}
 
private void radTrackBarElement1_ValueChanged(object sender, EventArgs e)
{
    if (this.radTrackBarElement1.Value != previousValue)
    {
        lastValue = this.radTrackBarElement1.Value;
        this.radTrackBarElement1.Value = previousValue;
    }
}
 
private void radTrackBarElement1_MouseUp(object sender, MouseEventArgs e)
{
    previousValue = lastValue;
    this.radTrackBarElement1.Value = lastValue;
}
 
float lastValue = 0;
float previousValue = 0;

I hope this information helps. If you have any additional questions, please let me know.  
 
Regards,
Dess
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
RibbonBar
Asked by
Vishal
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Vishal
Top achievements
Rank 1
Share this question
or