how to initiate touchgfx slider event from code
Hi eveyone!
I am using TouchGFX Designer 4.25.0
In the real world, you can only move a linear slider control by touching/moving the slider knob itself. One of the issues with using the TouchGFX Slider Widget is that it will instantly move from one position to another by touching/clicking anywhere on the slider scale. The graphical indicator (knob) is only there to indicate where the new setting sits on its scale of 0% to 100%.
I have 16 sliders, eight of which are visible at any one time. With my application, it would be a disaster if a user "accidentally" touched a slider (scale) and moved a setting from very low to very high in an instant. I have seen one post (a medical app !!) where the designer has the same problem.
++++++
So far, I have half a solution and would like to ask for help on how to solve my current dilema. Thanks in advance.
void ChannelFader::UpdateStatus() // Slider adjustment confirmed
{
/* other code here */
sliderChSlider.setTouchable(false);
}Here, I have disabled touch for the slider
I have created a background image behind the slider and created code to respond to it being touched
void ChannelFader::imgChFaderScaleClickHandler(const Image& b, const ClickEvent& evt)
{
if (&b == &imgChFaderScale)
{
int x = evt.getX();
int y = evt.getY();
/* here will be code to determine that slider indicator is being touched */
/* if so then ... */
sliderChSlider.setTouchable(true);
}
}This code works fine. And the slider is then set sliderChSlider.setTouchable(true)
Here's my problem ...
Releasing the click (onto the slider indicator) does indeed enable the slider. But I have to click again to re-enage with the slider and make it move.
What I would like to do is have a line of code that re-enages with the slider (as if I had clicked it). Then I can slide the indicator, set a new position, release it. Then the first snippet of code would then sliderChSlider.setTouchable(false) once more. And everythng would be safe again from accidental touches/clicks.
Many thanks for any insight you can offer to help me solve this dilema.
Regards
blueriver



