AGRAPH and Menus

Post here to share useful tips and tricks, to ask questions about using your DM42 or to report software-related problems
Post Reply
Pyyy
Posts: 2
Joined: Fri May 22, 2020 7:35 pm

AGRAPH and Menus

Post by Pyyy » Thu Jun 04, 2020 10:54 am

Hi,
I just noticed that AGRAPH shows menu labels in the message area if a menu is active.
As far as I can tell (using free42) this should not happen.

Code: Select all

00 { 29-Byte Prgm }
01▸LBL "FOO"
02 CLMENU
03 "A"
04 KEY 1 XEQ "FOO"
05 "A"
06 AGRAPH
07 MENU
08 STOP
09 GTO "FOO"
10 END
This example program shows some dots and the x-level of the stack on free42 but on the DM42 it shows the menu instead of the x-level.
The CIRCT program from the Electrical Engineering Solutions displays circuit elements in a similar way and there the menu keys hide the values of the circuit elements...
Does someone have a workaround for this?

whuyse
Posts: 67
Joined: Thu Dec 21, 2017 12:23 pm

Re: AGRAPH and Menus

Post by whuyse » Fri Jun 05, 2020 8:47 am

Moderator note: program surrounded by 'code' tags for compactness.

Yes, but it is a bit involved: use GETKEY to catch the menu keys.
A few things to know:
- you want GETKEY to catch only the keys you want, and do nothing on others. The simplest way is putting all key codes in ALPHA and using POSA to check for them, but I use a matrix instead (see below), as you may need the ALPHA register for AGRAPHs.
- GETKEY doesn't catch the EXIT key, which I have always found a shame; so you'll need to designate another key to exit.
- GETKEY doesn't catch the DM42 top row softkeys UNLESS a menu is present. That can be accomplished in program mode by EDITing a matrix.

The following program lets you add "A" or "B" to the screen when pressing softkey 1 or 2, repeatedly. Use key 6 to Exit. No menu labels are shown.
(this is the ONLY way I have found to interact with a graphics display; it is what I used in the matrix Viewer. Using MENU and pressing a key clears the LCD, and redrawing the whole DM42 screen takes too long for comfort.)

Code: Select all

00 { 106-Byte Prgm }
01▸LBL "AB"
02 CLLCD
03 3 @ set up the matrix of valid GETKEY codes
04 1
05 NEWMAT
06 EDIT
07 1
08 →
09 2
10 →
11 6
12 EXITALL
13 LSTO "GK"
14 EDIT @ EDIT a matrix so the top row keys work
15 1
16 ENTER
17 "÷" @ dummy AGRAPH to show the graphics screen on first GETKEY
18 AGRAPH
19▸LBL 09 @ main loop
20 CLA
21 SF 25
22▸LBL 10 @ GETKEY loop
23 GETKEY
24 RCL- "GK"
25 1/X @ causes an error when key valid, so CF 25 and LastX still contains keycode
26 R↓
27 FS? 25
28 GTO 10
29 GTO IND ST L
30▸LBL 01 @ add "A"
31 126
32 XTOA
33 9
34 XTOA
35 XTOA
36 XTOA
37 R↓
38 XTOA
39 GTO 00
40▸LBL 02 @ add "B"
41 127
42 XTOA
43 ├"III6"
44▸LBL 00
45 R↓
46 AGRAPH
47 6
48 +
49 GTO 09
50▸LBL 06 @ exit
51 EXITALL
52 CLD @ quit graphics screen
53 END
Cheers, Werner
42S #3249S01123
DM42 #00345

Post Reply