When writing a prop, how do I choose between (and why):
EVENT_SECOND_CLICK_SHORT
EVENT_SECOND_SAVED_CLICK_SHORT
Or the ONE, THREE & FOUR variation ?
They react to the same button press (2 short clicks) so they can’t be used with the same button in the same mode.
I am also wondering why we have both, I am guessing backward compatibility ?
Or is there something that one can do (or be combined with) and the other one can’t?
EVENT_SECOND_SAVED_CLICK_SHORT has a delay.
This delay is used to check if there is an additional, third (and fourth) click or not.
EVENT_SECOND_CLICK_SHORT does not have a delay, but is also triggered for 3-clicks and 4-clicks.
So;
If your prop doesn’t use any 3-clicks or 4-clicks, then you can use EVENT_SECOND_CLICK_SHORT to avoid having a delay before the action takes effect. A prop should generally not use both EVENT_SECOND_CLICK_SHORT and EVENT_SECOND_SAVED_CLICK_SHORT.
Thanks, that makes lot more sense now.
I finally understand why I get two things happening at the same time (on my jetpack mainly).
EVENT_SECOND_CLICK_SHORT
&
EVENT_THIRD_CLICK_SHORT
both would be triggered almost at the “same time”. Is there a case where this can be a desired option ?
As far as the user pressing buttons point of view, it’s the same actions in both lists (EVENT_PRESSED and EVENT_FIRST_PRESSED for example), right ? Do they “behave” differently software-wise ?
If you do a double-click, you get EVENT_FIRST_* for the first click and EVENT_SECOND_* for the second click. However, both clicks also generates EVENT_* events.
Using EVENT_* instead of EVENT_FIRST_* might make sense for something like a fire button, which might have rapid clicks, but you don’t want them to be interpreted like double-clicks.
If I understand correctly, if I do 2 short clicks followed by one long held for 3 seconds and released, these are the events that will be generated in order of “appearance”: (& means “at the same time”)
EVENT_PRESSED & EVENT_FIRST_PRESSED will be generated
EVENT_RELEASED & EVENT_FIRST_RELEASED & EVENT_CLICK_SHORT & EVENT_FIRST_CLICK_SHORT will be generated
these will not be generated because I am still clicking: EVENT_SAVED_CLICK_SHORT & EVENT_FIRST_SAVED_CLICK_SHORT
EVENT_PRESSED & EVENT_SECOND_PRESSED will be generated
EVENT_RELEASED & EVENT_SECOND_RELEASED & EVENT_SECOND_CLICK_SHORT will be generated
this will not be generated because I am still clicking: EVENT_SECOND_SAVED_CLICK_SHORT
EVENT_PRESSED & EVENT_THIRD_PRESSED will be generated
these will not be generated because I am still holding:
– EVENT_THIRD_HELD,
– EVENT_THIRD_HELD_MEDIUM
EVENT_THIRD_HELD_LONG will be generated
EVENT_RELEASED & EVENT_THIRD_RELEASED will be generated & EVENT_THIRD_CLICK_LONG might be generated even though I was holding 1 second too long ?
Except maybe for the last one, did I get it right ?
Note that the numbered event (FIRST) in this case comes before the non-numbered event, and if the numbered event returns true, the non-numbered event is not generated.
You forgot EVENT_CLICK_SHORT here.
And you forgot EVENT_HELD here. (etc.)
The limit is 2.5 seconds for long clicks.
If you had held it 2 seconds instead of three seconds, you would have gotten an EVENT_THIRD_CLICK_LONG and EVENT_CLICK_LONG events.
I think you have the gist of it, even if you got a few details wrong…
Now I understand how it works, I hope!
Pfffffff !
I was trying to use held, held medium and held long on the same button and same mode for my one button jetpack option because I was running out of pissibilities. I will be changing it to a two button prop only. I will cancel the PR on Github and re-submit when it is ready!
EVENT_FIRST_SAVED_CLICK_SHORT
EVENT_SECOND_SAVED_CLICK_SHORT
EVENT_THIRD_SAVED_CLICK_SHORT
EVENT_FOURTH_SAVED_CLICK_SHORT
EVENT_FIRST_HELD* (but only one of the 3)
EVENT_SECOND_HELD* (but only one of the 3)
EVENT_THIRD_HELD* (but only one of the 3)
EVENT_FOURTH_HELD* (but only of the 3)
So the maximum amount of “button events” that can be assigned to one button in the same mode is 8, unless I choose “while holding another button” (witch is not helpful for a one button setup). Is this correct ?
Isn’t held going to be released before click long thus rendering click long unusable if booth are assigned ?
It’s for a jetpack that will be an “on my back” kind of prop (not in my hand) and I am really the opposite of flexible and/or athletic. I am more like a John Favreau - Paz Vizla (except taller and much fatter) than a Pedro Pascal - Din Djarin (who probably doesn’t do front/back/side flips like animated Ahsoka without ropes, pulleys and stunt-double either) so I would like to not have to use motion or angles if possible?
But it’s not coded yet, right?
And what about this: // Long clicks cannot be "saved", so just emit immediately. (button_base.h, line 113)
'cannot be “saved” ’ because it is not coded yet or because it can’t be coded ?