Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bombsimon/garmin-touch-keypad
A barrel to display a numpad and read user input
https://github.com/bombsimon/garmin-touch-keypad
Last synced: about 1 month ago
JSON representation
A barrel to display a numpad and read user input
- Host: GitHub
- URL: https://github.com/bombsimon/garmin-touch-keypad
- Owner: bombsimon
- License: mit
- Created: 2024-11-19T21:30:27.000Z (2 months ago)
- Default Branch: main
- Last Pushed: 2024-12-08T22:30:32.000Z (about 2 months ago)
- Last Synced: 2024-12-24T01:50:15.239Z (about 1 month ago)
- Language: Monkey C
- Size: 669 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-garmin - garmin-touch-keypad - A barrel to display a numpad and read user input (2024-12-08) (Barrels / Older resources)
README
# Touch Keypad for Garmin
This is a barrel that can be used to push a view of a numpad and return the
picked number when pressing OK. Basically just a fancy number picker with some
settings to fit your needs.![screenshot](./assets/screenshot-small.png)
## Usage
Here's a complete example app using the barrel. Use VS Code's feature to add a
barrel, or if you for some reason do this manually edit `barrels.jungle` so it
contains:```text
TouchKeypad = [c:\path\to\garmin-touch-keypad\monkey.jungle]
base.barrelPath = $(base.barrelPath);$(TouchKeypad)
``````monkeyc
import Toybox.Lang;
import Toybox.WatchUi;import TouchKeypad;
class myDelegate extends WatchUi.BehaviorDelegate {
function initialize() {
BehaviorDelegate.initialize();
}function onMenu() as Boolean {
var view = new NumpadView({
:callback => method(:myCallback),
:input => "98.2",
:separator => ".",
:separatorLimit => 1,
});
var delegate = new NumpadDelegate(view);WatchUi.pushView(view, delegate, WatchUi.SLIDE_UP);
return true;
}function myCallback(input as String) as Void {
System.println("Got input " + input);
}
}
```### Settings
| Setting | Type | Description |
| ----------------- | --------------------------------- | -------------------------------------------------------- |
| `:callback` | `Method(value as Float) as Void ` | The method to call when pressing OK (default `null`) |
| `:input` | `String` | Starting input value (default `""`) |
| `:separator` | `String` | The separator to use on the keypad (default `.`) |
| `:separatorLimit` | `Number` | Max occurrances of the specified separator (default `1`) |
| `:vibrate` | `Boolean` | Vibrate on each key tap (default `true`) |