Current issue

Vol.26 No.4

Vol.26 No.4


© 1984-2024
British APL Association
All rights reserved.

Archive articles posted online on request: ask the archivist.


Volume 11, No.1

A Windows-Driven Menu Driver

by Jan Karman

In Stephen B. Jaffe’s paper at the APL86 Congress in Manchester a ‘menudriven menudriver’ was discussed. The driver consisted of a character matrix containing the menus and menu items, a pointer, pointing to the successive menu items and two functions, one of them displaying the correct menu items, and the other one pointing to the next ‘group’ of items or executing the lowest level menu item.

Now to do the same for Windows, we need to convert the same character array and menu pointers into a Window driven device. Suppose we have an application on making quotations for mortgages in our workspace MORTGAGE. The menu items with their pointers are as follows:

Row     Menu(item)     Pointer

     MENU     IMENU (variable name) 

01     MORTGAGES     0      
02     Quotation     1 
03     Output     1 
04     Linear     2 
05     Annuity     2 
06     Others     2 
07     Print     3 
08     Screen     3 
09     File     3 
10     Spreadsheet     3 
11     Life Insurance     6 
12     Variable rate     6 
13     Low rate incremental     6

For instance Linear, Annuity and Others point to Quotation, etc. In this example Quotation is a MENU and Linear and Annuity are MENUITEMs. Others is a MENU itself, because it is pointed to by Life Insurance, Variable rate and Low rate incremental. The latter are MENUITEMs in their turn. Now, we want to convert the list of items in a convenient Windows menu. MENUDRIVER is doing this, regardless of depth of pointer levels, using Dyalog APL/W.

Our first menu display looks like this:


If we click on Quotation our display becomes


and we may click further on Other:


and also the Output MENU, etc.

Close gives control to the workspace in a development environment and to Windows Program Manager in a Runtime application.

Help is generated by the MENUDRIVER function. The Help Window looks like this, and is editable by the user. It uses an external file for saving, so it can be used in Runtime applications.


This Window-driven menudriver is generated by

  • a function MENUDRIVER (see Appendix)
  • a character array with the names of the MENUs and MENUITEMs
  • a pointer controlling the relation of MENUs and MENUITEMs

The MENUDRIVER function takes any character array and pointers with the appropriate names. So, the only thing you have to do is edit these variables. This is done by a function EDITMENU, which takes the result of MENULIST as a character array as shown above. The last item in any relation (which is a MENUITEM in the terminology of Dyalog) should carry the name of a cover (callback-) function and clicking should take care of execution.

MENULIST and EDITMENU are simple functions which need no further explanation. BLANKOUT is a function published and explained in the quoted reference. SORT is an ambivalent function which sorts a list of variables in the right argument, according to the key formed by the variables in that argument or an optional list of variables in the left argument.


  1. Jaffe, S.B. Building better user interfaces. APL86 Conference Proceedings (ACM 1986)


(webpage generated: 30 August 2007, 16:53)

script began 12:02:04
caching off
debug mode off
cache time 3600 sec
indmtime not found in cache
cached index is fresh
recompiling index.xml
index compiled in 0.1768 secs
read index
read issues/index.xml
identified 26 volumes, 101 issues
array (
  'id' => '10004280',
regenerated static HTML
article source is 'HTML'
source file encoding is 'ASCII'
read as 'Windows-1252'
URL: mailto:-*- => mailto:-*-
URL: mailto:-*- => mailto:-*-
URL: karman111_139-fig1.gif => trad/v111/karman111_139-fig1.gif
URL: karman111_139-fig2.gif => trad/v111/karman111_139-fig2.gif
URL: karman111_139-fig3.gif => trad/v111/karman111_139-fig3.gif
URL: karman111_139-fig4.gif => trad/v111/karman111_139-fig4.gif
completed in 0.2011 secs