The soft-menu engine is ready to go.
The engine is quite more flexible than the old one, while it remains mostly compatible.
The basic format is the same:
 
{ Item1 Item2 ... }
 
Each item can be a single object or a list with 3 individual components:
 
Item1   ...or... { Display Action Help }
 
When the item is an object, it will simply be used as follows:
  • An IDENT will be looked up as a variable, and the actions will behave as in the VARS menu. If it happens to be a directory name, then it will look like a directory does in the VARS menu. Long-press will display a preview of the contents of the variable.
  • A UNIT object with a numeric portion equal to 1 will be displayed without the numeric portion, and it will behave as if it was in the UNITS menu.
  • A command will work as expected, but also help will be automatically displayed upon long-press.
  • All other objects will be decompiled for Display, executed for action, and no help will be provided.

When the item is a list, there's 3 main components:

Display:

It can be a single object or a list with 2 elements. When it's a single object, it will behave as follows:

  • A program will be executed, and it must leave one object on the stack, which will take its place as the Display object.
  • A GROB will be displayed as-is in the soft menu.
  • A string will be displayed without quotes
  • A UNIT with a quantity of 1 will be displayed without the numeric part.
  • All other objects will be decompiled and the resulting string shown on the soft menu

The display object can be a list with 2 elements: { Display Decoration }

The Display object works as described above, while the decoration must be an integer that indicates if the element has to be displayed normally, inverted, as a directory, with a "checked" checkmark, with a "unchecked" checkmark, etc.

Action

The action object will be executed when the user activates the soft menu. It can be an object, or a list of 3 or 5 components:

Action (all key combinations cause the same action)

{ Normal Left-Shift Right-Shift } (a different object will be called when the user presses the item in each shift state)

{ Normal Left-Shift Right-Shift Left-Hold-Shift Right-Hold-Shift } (a different object will be called when the user presses the item in each shift state, in this case it also distinguishes between shift and shift-hold presses)

When an action object is executed, the following rules are followed:

  • A single command or operator will be executed, or its name will be inserted in the editor if the command line is active
  • A UNIT object provides various actions depending on the shift used, similar to the UNITS menu.
  • An IDENT object has various actions, similar to variables in the VARS menu.
  • All other objects will be XEQ'ted.

Help

The help object can only be a string. The string will be displayed when the user long-presses the soft-key.

Optionally, the item may not have a Help object (defined only as { Display Action }).

 

So where's the extra flexibility?

The display object can be a program! This allows to programatically change a menu item appearance.