Timo 2018-11-06 14:10 (Edited)
Touch Zones is a simple GUI library with the following features:
- Define interactive zones
- Check touch/mouse events like "down", "drag", "up" and "out"
- Automatic highlighting with different palettes (optional)
- Correct focus handling, no accidental button clicks
- Users can cancel button clicks by dragging outside a button zone
This is an example program including the library. It was created for the official LowRes NX tools.
S3B4 2020-05-10 03:05
Any chances you will update this so it’s compatible with the new version of NX?
Timo 2020-05-10 11:24
Yes, I'll do. Just forgot about it.
G-9 2020-10-18 11:10
Theres a syntax error
Timo 2020-10-18 12:21
Sorry, finally uploaded the fixed version :)
G-9 2020-10-18 14:42
Thank you so mUch
nathanielbabiak 2020-12-10 03:32
Thanks for updating! :-)
nathanielbabiak 2022-06-16 20:05 (Edited)
I added support for timed events by adding GLOBAL ZONE_DTIME
and inserting a single line of code just before END SUB
within ZONE_UPDATE
:
IF CUR_ZONE=-1 THEN ZONE_DTIME=-1 ELSE INC ZONE_DTIME
The variable ZONE_EVENT
can be used as a 'setting' (in addition to a 'status getter' as indicated in the source). If you want to defocus the current zone (for example, with timed or drag events), set ZONE_EVENT=E_UP
or ZONE_EVENT=E_OUT
.
Here's some time graphs to make the learning curve easier for others:
'TIME GRAPHS.
'
' [.]FALSE=0 [T]TRUE=-1 [-]NONE=-1 [D]DOWN=1 [U]UP=2 [X]OUT=3 [R]DRAG=4.
'
' USER TOUCH OUTSIDE ALL ZONES.
' +--------------+----------------------------------------------------------------+
' | | |
' | TIMER | 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
' | TAP | . . . . . . T . . . . . . . . . . . . . |
' | TOUCH | . . . . . . T T T T T T T T . . . . . . |
' | CUR_ZONE | - - - - - - - - - - - - - - - - - - - - |
' | ZONE_EVENT | . . . . . . . . . . . . . . . . . . . . |
' | ZONE_DTIME | - - - - - - - - - - - - - - - - - - - - |
' | | |
' +--------------+----------------------------------------------------------------+
'
' USER CLICK INSIDE ZONE 9.
' +--------------+----------------------------------------------------------------+
' | | |
' | TIMER | 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
' | TAP | . . . . . . T . . . . . . . . . . . . . |
' | TOUCH | . . . . . . T T T T T T T T . . . . . . |
' | CUR_ZONE | - - - - - - 9 9 9 9 9 9 9 9 9 - - - - - |
' | ZONE_EVENT | . . . . . . D - - - - - - - U . . . . . |
' | ZONE_DTIME | - - - - - - 0 1 2 3 4 5 6 7 8 - - - - - |
' | | |
' +--------------+----------------------------------------------------------------+
'
' USER DRAG (MODIFY Z_IN_X, Y) WITHIN ZONE 9 HALF-WAY THROUGH CLICK.
' +--------------+----------------------------------------------------------------+
' | | |
' | TIMER | 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
' | TAP | . . . . . . T . . . . . . . . . . . . . |
' | TOUCH | . . . . . . T T T T T T T T . . . . . . |
' | CUR_ZONE | - - - - - - 9 9 9 9 9 9 9 9 9 - - - - - |
' | ZONE_EVENT | . . . . . . D - - - R - - - U . . . . . |
' | ZONE_DTIME | - - - - - - 0 1 2 3 4 5 6 7 8 - - - - - |
' | | |
' +--------------+----------------------------------------------------------------+
'
' USER DRAG OUT FROM ZONE 9 HALF-WAY THROUGH CLICK.
' +--------------+----------------------------------------------------------------+
' | | |
' | TIMER | 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
' | TAP | . . . . . . T . . . . . . . . . . . . . |
' | TOUCH | . . . . . . T T T T T T T T . . . . . . |
' | CUR_ZONE | - - - - - - 9 9 9 9 9 - - - - - - - - - |
' | ZONE_EVENT | . . . . . . D - - - X . . . . . . . . . |
' | ZONE_DTIME | - - - - - - 0 1 2 3 4 - - - - - - - - - |
' | | |
' +--------------+----------------------------------------------------------------+
'