Using only 3 buttons - modifying button actions #94
-
Hi, I am using GEM for a fairly advanced menu with only 3 buttons - Enter, Up (or Left), and Down (or Right). So far I have been able to control everything (some bools and 0-9 integer values) with this. But now I would like to modify some float variables and unfortunately I have no way to go to the left and right digits. Main question: Is there any way I could use the Enter key to go to the next digit in a float menu item? That would solve my issue. Perhaps when the user presses Enter on the last digit, it gets confirmed. Or even better, if possible, the user can hold the Enter key for 2 seconds to confirm the value. Short presses would just work like the Right key being pressed. One additional question: Is there any way to set first digit to be edited to the least significant digit (right-most digit)? By default when I hit enter on a float menu item, it starts editing the most significant digit (left-most digit). Changing it could be useful for certain values and menus. Appreciate any help or advice. Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Update: Don't know how I missed this discussion. Going to try it first, sorry! Update 2: Tried making GEM._editValueMode public. Enter key now probably triggers Right key too but since Enter key is also being pressed, it comes out of editing the float menu item. So I still need assistance on what I might be missing here. |
Beta Was this translation helpful? Give feedback.
Hi there!
In order to override default behavior of key presses you have to pass key codes to
menu.registerKeyPress()
method explicitly as described in Control menu from your sketch section of wiki. You may want to do that based on the value of_editValueMode
flag that you've made public (btw, preferred way to do that w/o modification of source code is as described in Inherit classes section of wiki). Also be aware of selects, as they behavior should be left as is.So very roughly it may look something like this (not tested!):