spectre Posted November 25, 2016 Report Posted November 25, 2016 Dear friends, as newbie I've created a simple gui with a simple button for my mcu + tft board using the uGFX studio 0.15 So I have my ghButton1 widget in the gui.c. I want to simulate a button press/release using a boolean variable: so my application can simulate a push/release of the button on the screen. can you give me a simple hint or some example code to simulate a press/release ? thanks in advance Spectre
Joel Bodenmann Posted November 28, 2016 Report Posted November 28, 2016 Hello @spectre, There is no high-level API to simulate a button click. The button widget itself doesn't contain that function because it would bloat the code size a lot (there would be the need for a GTimer and so on). This would mean that we have to make it become a feature that can be toggled on and off and that makes things become complicated & hard to maintain. We feel like this feature adds a lot of trouble for very little to no gain - hence it's not there. The proper way to handle your issue is by creating a function that generates the button-pressed-event in your own code. You can test your entire GUI that way: Simply create a testbench that doesn't do anything other than pushing events that have the same signature as the ones that are fired by the widgets themselves.
spectre Posted November 28, 2016 Author Report Posted November 28, 2016 Dear Sir, thanks for your exhaustive answer, the problem is that I don't know the way to "create the function that generates the button pressed-event". I've succeeded increment and decrement a progress bar, but simulate the button press is a bit difficult to me. Can you write me down a simple example? it will be really appreciated, thanks, Spectre
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now