2024-11-26 07:36 PM
Hi All,
This is my first foray into TouchGFX/STM32 code and I can use TouchGFX Designer to lay out a screen and upload it to my Riverdi display very easily. I have it set up along side STM32CubeIDE (also first time using) and can generate and modify code freely. Even adding custom event code is quite easy. However, I need to modify the behaviour of the button widget itself. I need to trigger an event on both button press AND on button release (I want to do stuff while the user holds down the button and stop doing it when they let go). The standard widget does it on release only. I've seen a topic on here that seems to deal with this here however it looks like a code-only approach and I would like to still be able to layout screens using the Designer. My approach was to lay everything out graphically and then create my own button classes and just substitute my class after exporting to CubeIDE. I couldn't get this to work though as I'm not sure where to put my cpp/hpp files, or even if this approach would have any chance of working.
Basically: I want to layout the screens graphically, but still have the ability to SELECTIVELY change the operation of the standard buttons to trigger on press. Only some buttons need the trigger on press capability.
What's the best/easiest method to get something working? I'm biasing slightly towards easiest as this is only a demo app that I need to show to a client. The final version may be quite different.
Thanks in advance
2024-11-28 04:55 AM - edited 2024-11-28 04:56 AM
Hello @AdamLX,
You can directly use flex button, it already has a trigger mode touch, which is a press trigger.
Best regards,
2024-11-28 03:14 PM
Hi Louis,
Thanks for the tip. This works for PRESS, but how do you get it to work for RELEASE? I want to perform an action while the user is holding the button and immediately stop once they let go. I can only get it to work either on PRESS (flex button) or on RELEASE (regular button), but not both.
2024-12-04 02:40 AM
Hello @AdamLX ,
You could try to combine the flex button with Mixins | TouchGFX Documentation, to get the desired result.
Best regards,