Post Reply 
(42S,Free42,DM42) Dynamic Menu
02-10-2018, 04:04 PM
Post: #1
(42S,Free42,DM42) Dynamic Menu
Dynamic Menu
============

0.Abstract

This routine will show a menu defined by the first column of a matrix, with
automatic paging. The matrix may have one or more columns.

1.Usage

In:
.matrix indexed or edited, IJ pointing within the page to show.
A: message to show with menu. If alpha reg is clear, no AVIEW will be done.
The message may be at most 24 characters.

Out:
- when pressing a menu button:
matrix indexes IJ at selected element
X: whatever was entered before pressing the menu button
- when pressing EXIT:
F25 Set

2.Routine details

The menu will be made up of 'pages' of 6 items each. The entry indexes IJ
will be repositioned to the start of a page before building the menu.
The up/down arrows will only be defined when the matrix has more than 6 entries.
When indexing or editing a matrix, the indexes IJ will be both 1.
This routine does not use variables.
For an example of how to use it, see the Conversion program posted right after this one.

3.Commented Listing

Code:
 { 209-Byte Prgm }
>LBL "DMENU"
>LBL 12
 XEQ 13        -- set IJ to first entry in page
>LBL 11        -- IJ in YX
 CLMENU
 X!=Y?        -- when this is not the first page, show up/down keys
 XEQ 78
 ASTO ST Z    -- save message
 ASHF
 ASTO ST Y
 ASHF
 ASTO ST X
 ASHF
 ASTO ST L
 KEY 9 GTO 09    -- build menu page
 XEQ 14        -- CLA RCLEL ARCL ST X Rv I+
 KEY 1 GTO 01
 FS? 76
 GTO 00
 XEQ 14
 KEY 2 GTO 02
 FS? 76
 GTO 00
 XEQ 14
 KEY 3 GTO 03
 FS? 76
 GTO 00
 XEQ 14
 KEY 4 GTO 04
 FS? 76
 GTO 00
 XEQ 14
 KEY 5 GTO 05
 FS? 76
 GTO 00
 XEQ 14
 KEY 6 GTO 06
 FC? 76
 XEQ 78        -- handles the case where it is the first page, and there are more
>LBL 00
 I-        -- get back to the correct page. F76 state is preserved!
 CLA        -- rebuild message
 ARCL ST Z
 ARCL ST Y
 ARCL ST X
 ARCL ST L
 XEQ 13        -- set indexes back to first entry in page
>LBL 10
 ALENG
 X>0?
 AVIEW
 MENU
 STOP
 GTO 10
>LBL 06
 I+
>LBL 05
 I+
>LBL 04
 I+
>LBL 03
 I+
>LBL 02
 I+
>LBL 01
 CF 25
 RTN

>LBL 07        -- previous page
 I-
 GTO 12

>LBL 08        -- next page
 RCLIJ
 CLX
 6
 +
 FS? 76
 SIGN
 1
 STOIJ
 GTO 11

>LBL 09
 SF 25
 RTN

>LBL 13
 RCLIJ
 SIGN
 -
 RCL ST X
 6
 MOD
 -
 1
 STO+ ST Y
 STOIJ
 RTN

>LBL 14
 CLA
 RCLEL
 ARCL ST X
 Rv
 I+
 RTN

>LBL 78
 KEY 7 GTO 07
 KEY 8 GTO 08
 END

The raw file is also attached.
Cheers, Werner


Attached File(s)
.zip  DMENU.zip (Size: 338 bytes / Downloads: 26)

41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)