GUI Look And Feel

The Print window manager gives special meaning to each mouse button as described in the PrintWindowManager section.

This interface is profligate in its use of windows. In the course of a simulation it is expected that windows will be created and destroyed freely. In OpenLook one dismisses a window merely by pressing the right(menu) button in the window header area and selecting dismiss. If your window manager does not support easy dismissing of windows then you MUST invoke nrniv with the automatic dismiss button feature. The default widget style is MOTIF but openlook style can be selected. The relevant options are

nrniv -dismissbutton -openlook ...


Graphs and Shape windows are instances of views into a scene.

objref g
g = new Graph()
g.label("here is some text")
g.line(100, 50)
g.line(200, 100)

// pop up an example of a scene

A scene is defined as the space represented by the model coordinate system. A view is defined as that portion of the scene which is drawn in the window. There can be many views into a scene and each scene has its own menu selections but they can be different for different scenes. Scenes use an openlook style in which the right(menu) mouse button pops up menus from which one either selects an action to be performed immediately, eg. Round or Whole Scene, or else selects a meaning for the left(select) mouse button which will be used when the left mouse button is pressed within any view of that particular scene. This can be thought of as selecting a tool with the right button and wielding that tool with the left button. These menu items are like radio buttons in that only one is active at a time. It is recommended that when you move into a view you quickly pop up the menu so you can be certain of the meaning of the left button. The middle button translates the view around the scene. All scenes have a common View menu as the first menu item with which one can create a new view, zoom in/out, round the view or make the view correspond to the natural size of the scene.


View = plot: scale the view with respect to the variables being plotted.


10% Zoom out: View more of the scene keeping the center of the view fixed.


10% Zoom in: View less of the scene keeping the center of the view fixed.


New View: Mode for creation of new view windows. Use the left mouse button to draw a rectangle in the view which will become the interior of a new view. Press the left mouse button at one corner of the desired view and drag it to the opposite corner. The new view window can then be resized and positioned using your window manager.


Zoom in/out: The location where the left mouse button is pressed is the fixed point of zooming, ie doesn’t change its position. Dragging the mouse up and to the right zooms in. Dragging the mouse down and to the left zooms out. Graph views have independent scaling in the x and y directions. There is a bias toward changing only one dimension corresponding to the general drag direction. Shape views have a constant aspect ratio so only the x direction is used for zooming.


Translate: Drag the scene around in the view. The middle mouse button is always attached to this tool. There is a drag bias which makes it easier to move in the horizontal or vertical direction without change in the other dimension.


Round View: The header of each view window shows the size of the canvas in model coordinates. Pressing this button rounds the view so these numbers don’t have so many decimal places. The algorithm for rounding needs improvement.


Whole Scene: Adjusts the zoom and translation so the view is of the entire scene with a 10% border.


Set View: Successive dialogs for x and y view size each require user to enter two space separated numbers for the beginning and end of axis. Default values are left, right, bottom, top of view reduced by 10%. The view size is set to the entries and then the view zooms out by 10%. ie accepting the default values leaves the view unchanged.


Scene=View: Defines the size of the whole scene. Sets the scene size to the size of the view. Subsequent Whole Scene adjustments will return to this size.


Prints the name by which the interpreter knows this object. Within this session the user can use this name to manipulate the object via interpreter commands.


Browsers are visible lists.

// pop up example of a browser
objref f
strdef tempstr
f = new File()
f.chooser("", "Example file browser", "*", "Type file name", "Exit")
while (f.chooser()) {
print tempstr

The list can be scrolled with a scroll bar but I think it is most convenient to drag the list up and down with the middle mouse button. Rate scrolling is controlled with the right mouse button. The left button highlights a selection. Double clicking generally executes the selection. Browsers are used to select files for printing, variables for plotting, etc. Sometimes, a browser has a field editor in which one can directly type an entry. Usually after an item has been selected you have to press an Accept or Cancel button to actually execute the selection. Browsers can be scrolled with d, u, j, k, n, p and others.


See also ValueEditor, a FieldEditor for floating point numbers. Field editors accept a string entered by the user. The allowed strings are determined by the context. In not all cases does typing the return key signal the execution of a selection (if not, press the accept button). Field editors have an emacs-like syntax and typing characters inserts them at the cursor. The left mouse button specifies the cursor location and dragging selects a portion of the string. After selecting a portion of the string, typing a character will replace that portion with the character.

    ^A beginning of line
    ^E end of line
    ^F forward one character
    ^B backward one character
    ^U select whole string
    ^W select from cursor to beginning of string
    ^D delete next character
    ^H delete previous character
    return (normally accept)
    escape, ^G (normally cancel)
    and others


Panels: windows containing buttons, menus, and value editors. All mouse buttons mean the same thing.

If the number of items in a vertically arranged single panel is greater than the number in the *panel_scroll: resource in the $(NEURONHOME)/lib/nrn.defaults file (default 12) then the panel items are shown in a scroll box so that they do not take up so much screen space.

See xpanel() for hoc functions to generate panels

// pop up example panel
strdef tempstr
tempstr = "slider................."
xx = 0
xpanel("Example Panel")
xbutton("PushButton", "print \"released button\"")
xlabel("Following two are for variable x")
xvalue("Value Editor", "x", 0, "print x")
xvalue("Default Value Editor for variable x", "x", 1, "print x")
xcheckbox("Checkbox", &y, "print \"state y is \", y")
xstatebutton("StateButton", &z, "print \"state z is \", z")
xmenu("Example Menu")
xbutton("Item 1", "print \"selected item 1\"")
xbutton("Item 2", "print \"selected item 2\"")
xcheckbox("Checkbox", &y, "print \"state y is \", y")
xradiobutton("Radio 1", "print 1")
xradiobutton("Radio 2", "print 2")
xradiobutton("Radio 3", "print 3")
xlabel("Following 3 are mutually exclusive")
xradiobutton("Radio 1", "print 1")
xradiobutton("Radio 2", "print 2")
xradiobutton("Radio 3", "print 3")
xslider(&xx, 0, 100, "sprint(tempstr, \"slider for xx = %g\", xx)")


Buttons: execute an action when the mouse button is pressed and released over the button widget.


Value editor: A combination button with label and a field editor. If a value is being entered the label is colored yellow and there is a cursor in the field editor. You might have a desired value in the editor but if the label is yellow the computer will not know it. Make sure values are accepted by pressing return or by pressing the button. Arbitrary expressions may be entered into value editors. They will be replaced by their value upon acceptance. Pressing the middle/right mouse button over a digit will increase/decrease the digit by 1. Dragging will increase/decrease repeatedly. (but don’t forget to release the label button to accept the value).

Default Value Editor

Default Value editor: These value editors have an extra check box to the left of the value field which is marked when the value is different from its creation value. One may toggle between the default and most recent value by pressing the check box with the left or middle mouse button. The default value may be permanently changed by pressing the check box with the right button. On the right of the value field is a stepper (little button with the up arrow) that is used to change values in lieu of typing a number. The stepper works as follows: left mouse button: increase by the increment middle mouse button: decrease by the increment right mouse button: select the increment. Res stands for resolution and means the increment is the least significant digit in the value field. The only other increments are the decades between .001 and 1000. When holding down the left or right mouse button, after a short time the stepper will repeatedly increment the value field. Every 20 steps, the increment will increase by a factor of 10 but will return to its first step value on release. The repetition mode will not cross 0. To cross 0 release and re-press. Only on release of the mouse button will the action (if any) be executed and finally all value editors will be updated. The default increment starts at the least significant digit in the value field. Stepper delays use the resources:

  • autorepeatStart: .05 //seconds

  • autorepeatDelay: .02



Crosshair: shows coordinates and enables access to all line data. Press the left mouse button (LMB) near a line and drag the mouse left or right. A cross hairs will appear with the x,y value in model coordinates. The behaviour of the cross hairs makes it convenient to find local maxima. On creation the crosshairs starts at the nearest point on the line. On dragging it searches from the last point for the nearest point but will stop searching if any point becomes farther away. This makes it possible to easily follow phase plane plots. Crosshairs may call a hoc function on a keypress. See Graph.crosshair_action().

If no crosshair action has been installed, any keypress will print the x,y coordinates of the crosshair in the terminal window.

Note that a crosshair_action can obtain all the x,y coordinate data for a line. Also the global variables hoc_cross_x_ and hoc_cross_y_ contain the last value of the crosshair coordinates.


Plot What?: Pops up a browser with which one can navigate to any variable (double clicking) to enter it into the field editor. Double clicking on object names or section names will cause more names to appear in the adjacent browser and allows one to quickly build a complete symbol name. Alternatively one can directly type or edit the name in the field editor. When you are satisfied with the name in the field editor type return or press the accept button. The program will check if the name (or arbitrary expression) is interpretable and, if so, will be added to the list of expressions to be plotted in this graph whenever Graph.plot(xvalue) is executed. Warning: some names in the browsers are not interpretable or make no sense being plotted. If there are inconveniently many names in the first browser, you can use the Show menu to reduce the selection to only variables, objectvars, sections, or objects. Note that the objects allow plotting of variables which may otherwise not be accessible to the interpreter because there is no objectvar that references them. However, unfortunately, such graph lines cannot be saved in a session.

If a variable in the browser contains the word [all] in place of an explicit index then the Graph will plot it as a function of its index. See Graph.vector() .


When this tool is chosen, clicking the left mouse button near a graphed line will copy the y and x coordinates of the line into two new Vector’s which are referenced by hoc_obj_[0] and hoc_obj_[1] respectively. The vectors may be saved to a file by selecting the Save to File item from the Vector menu of the NEURONMainMenu


If the graph is doing a space plot with a RangeVarPlot then the PlotWhat item changes its style to request entry of another range variable to plot using the same path. Also one can enter an expression involving $1. The expression will be executed for each section in the path for each arc position set to $1.


Change Color: Pops up a color and brush palette to select the default color and brush style for the graph. Clicking on text or lines will change the line/text to that style. After the palette is dismissed it can be retrieved by clicking on another radiomenu item and then clicking on this one again. Note: Lines associated with labels always have the same color. Kept lines are not associated with labels. The number of selectable colors and brushes may be set by changing the values in your ~/.nrn.defaults file (see CBWidget in $(NEURONHOME)/lib/nrn.defaults)


Axis Type: Menu of View Axis, New Axis, View Box, and Erase Axis.


View Axis: Erases the old axis and draws a set of axes in the background. The axes are sized dynamically with respect to the view coordinates.


New Axis: Erases the old axis and draws a new axis in a rounded view. The new axis depends on the size of the view and is the same in every view of the scene.


View Box: Erases the old axis and draws an axis box as a background with clipping. The box is sized dynamically with respect to the view coordinates.


Keep Lines: While checked, lines are saved. When not checked the previous line is discarded every time Graph.begin() is executed in preparation for plotting new lines. A useful idiom to save a reference line is to toggle the Keep Lines item on and then off.


Pops up a global (same for all Graph windows) symbol chooser which is used to select a label for KeepLines. Function is identical to Ie. the label is used as a variable name and the value of the variable is used to actually label the kept lines. To get a compatible label (instead of an Graph.addexpr() label) for the last line, the KeepLines menu item should be toggled off.

If all lines are labeled and have the same size then Ascii has a matrix format.


Lines are erased but not text or axes.


One can drag text to another location in the scene.


Clicking on existing text allows one to change it. Clicking on an empty spot creates a label at that location. One can change a plot expression. eg. to add a scale factor. Labels for plot variables that use the more efficient pointers cannot be changed. Labels can be marked as either fixed with respect to scene/model coordinates or fixed with respect to view/screen coordinates


Delete: One can delete text or lines by pressing the left key while the mouse cursor is over the object. If the text is associated with a line the line is deleted as well as its label.