Dear AM team
I ran into a problem and couldn't solve it. I only have one button. A quick click it triggers a function on the screen. The same button if pressed for 3 seconds they turn off the instrument inserted a black screen.
Could you give me some guidance on how to do it?
Thanks
A button with two functions defined by pressing time.
- Marcnamara2021
- Posts: 83
- Joined: Wed Dec 01, 2021 6:00 am
- Location: Sao Jose dos Campos, SP
Re: A button with two functions defined by pressing time.
You'll have to work with the released callback and a timer, the timer is started in the pressed callback and stopped in the release callback.
- Crunchmeister
- Posts: 222
- Joined: Tue Aug 10, 2021 2:06 pm
Re: A button with two functions defined by pressing time.
Seta timer that fires when the button is pressed.
In the release callback, if the time held is less than 3 seconds, then it fires the event for the quick click. If timer reached 3 seconds, then use the long press event.
In the release callback, if the time held is less than 3 seconds, then it fires the event for the quick click. If timer reached 3 seconds, then use the long press event.
Last edited by Crunchmeister on Thu May 19, 2022 4:17 pm, edited 1 time in total.
- Ryzen 5950x, 64GB 3600MHz RAM, RTX3070Ti
Simstrumentation Instrument dev
Free Air Manager instruments for MSFS available at http://www.simstrumentation.com
Simstrumentation Instrument dev
Free Air Manager instruments for MSFS available at http://www.simstrumentation.com
- Marcnamara2021
- Posts: 83
- Joined: Wed Dec 01, 2021 6:00 am
- Location: Sao Jose dos Campos, SP
Re: A button with two functions defined by pressing time.
Thank You guys. I will try.
Marcio
Marcio
- Marcnamara2021
- Posts: 83
- Joined: Wed Dec 01, 2021 6:00 am
- Location: Sao Jose dos Campos, SP
Re: A button with two functions defined by pressing time.
Hi I tried several ways to establish this function and I couldn't. Could you explain better, please, exemplifying a script, or pointing out where in the Forum there is a similar one, if possible.
tank You
tank You
- Crunchmeister
- Posts: 222
- Joined: Tue Aug 10, 2021 2:06 pm
Re: A button with two functions defined by pressing time.
Take a look at the code for the CLR button on the G1000 NXi bezel. It has a long press function using a timer.
Last edited by Crunchmeister on Mon May 23, 2022 2:30 pm, edited 1 time in total.
- Ryzen 5950x, 64GB 3600MHz RAM, RTX3070Ti
Simstrumentation Instrument dev
Free Air Manager instruments for MSFS available at http://www.simstrumentation.com
Simstrumentation Instrument dev
Free Air Manager instruments for MSFS available at http://www.simstrumentation.com
- Marcnamara2021
- Posts: 83
- Joined: Wed Dec 01, 2021 6:00 am
- Location: Sao Jose dos Campos, SP
Re: A button with two functions defined by pressing time.
Hi Guys
Thank You for the information. The long press button is ok now.
Regards
Marcio
Thank You for the information. The long press button is ok now.
Regards
Marcio