JMRI is...

Common Tools

JMRI provides powerful tools for working with your layout.

System-specific Tools

Layout Automation

JMRI can be used to automate parts of your layout, from simply controlling a crossing gate to running trains in the background.

JMRI: Memory Variables Documentation

A JMRI memory variable can hold any type of object. It's really up to user code what to put in them, and how to manipulate them.

The Memory Variable Table

The Memory Table lets you see what memories have been defined, and what value they currently contain. The table will ask the contents of the memory to display itself, so an image or icon will show as a picture in the table; most other things will show as as string. You can type a new string value into a memory, or create a new memory variable.

Using Memories With Logix

A Logix can test a memory for particular contents, and set the contents of a memory to whatever string is needed. This lets you use a memory as a status indicator, counter or just about anything else you can imagine. Because of their user interface, Logix generally only put string values into memory variables.

Displaying a Memory Variable on a Panel

The contents of a memory can be displayed on a panel. Usually, the memory will try to display its contents directly. If the contents are an icon, image or string, the contents will be shown directly. As a special case, if the contents of the memory are "null" (the memory contains no object), a red X icon is displayed. This lets you see and position the memory on the panel. If the memory contains the zero-length string "", that's an object, and it will be displayed as blank space.

You can customize the appearance of text in the icon via its pop-up menu.

You can also define a series of icons to be displayed in place of the memories own content's if you'd like. For an example of how this is done, please see the sample XML file. Use your browser's "view source" command, or download that file to see how it's done. Basically, the XML browser file has a "memoryicon" element that carries various information about where to put the icon, whether it can be selected, etc. Within that element, you can define "memorystate" elements that define what icon to show when the memory has a specific value:

    <memoryicon memory="IM20" defaulticon="program:resources/icons/misc/Question-black.gif">
      <memorystate value="9" icon="program:resources/icons/misc/Nixie/M9B.gif" />
      <memorystate value="8" icon="program:resources/icons/misc/Nixie/M8B.gif" />
    </memoryicon>
(That example has been simplified by omitting some stuff from the memoryicon element) In the example, the two memorystate elements ensure that if the memory contains "9" or "8", certain images will be shown, otherwise a default black question mark icon will be shown.

Unfortunately, JMRI doesn't have a nice GUI tool for defining the icons displayed when using a memory icon this way. You have to edit the XML file by hand, following one of the examples.