Next: 6.12.1.2 Dynamic menu items Up: 6.12.1 Tools and toolkits Previous: 6.12.1 Tools and toolkits Contents

### 6.12.1.1 Static menu items

Zero-argument classes within toolkits are displayed as pull-right menus. You can nest classes to any depth. If a member of a zero argument class is an instance of the class `Menuseparator`, it is drawn as a menu separator. This can be useful to give visual grouping to a menu.

`nip2` uses the first line of the comment before a definition as help text for that function, so it's a good idea to put a simple one-line description of the function at the start of a comment.

For example, if the following text is placed in a file called `Fred.def` on `nip2`'s start path, you'll get a menu in the tookits called `Fred` with a pull-right and a separator. See Figure 6.1.

> | `` | `` |  | `` | `` |  | `` | `` |  | `` | `` |  | `` | `` |  | `` | `` |  | `` | `` |  | `` |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |
> | `Banana a = a * 3;` |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |
> | `Subfred = class {` |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |
> |  |  |  | `// add two things` |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |
> |  |  |  | `Jim a b = a + b;` |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |
> |  |  |  | `Apple e = e * 12;` |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |
> |  |  |  | `sep1 = Separator;` |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |
> |  |  |  | `Harry z = 12 + z;` |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |
> | `}` |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |

Figure 6.1: How `Fred.def` will look

Next: 6.12.1.2 Dynamic menu items Up: 6.12.1 Tools and toolkits Previous: 6.12.1 Tools and toolkits Contents