Routines (alphabetical) > Routines: X > XDISPLAYFILE

# XDISPLAYFILE

The XDISPLAYFILE procedure is a utility for displaying ASCII text files using a widget interface. In addition to allowing users to read and optionally edit text files, the utility allows you programmatically interact with the text widget.

This routine is written in the IDL language. Its source code can be found in the file `xdisplayfile.pro` in the `lib/utilities` subdirectory of the IDL distribution.

## Syntax

XDISPLAYFILE, Filename [, /BLOCK] [, DONE_BUTTON=string] [, /EDITABLE] [, FONT=string] [, GROUP=widget_id] [, /GROW_TO_SCREEN] [, HEIGHT=lines] [, /MODAL] [, RETURN_ID=variable] [, TEXT=string or string array] [, TITLE=string] [, WIDTH=characters] [, WTEXT=variable]

## Arguments

### Filename

A scalar string that contains the filename of the file to display. Filename can include a path to that file.

## Keywords

### BLOCK

Set this keyword to have XMANAGER block when this application is registered. By default, BLOCK is set equal to zero, providing access to the command line if active command line processing is available. Note that setting BLOCK=1 will cause all widget applications to block, not just this application. For more information, see the documentation for the NO_BLOCK keyword to XMANAGER.

Note: Only the outermost call to XMANAGER can block. Therefore, to have XDISPLAYFILE block, any earlier calls to XMANAGER must have been called with the NO_BLOCK keyword. See the documentation for the NO_BLOCK keyword to XMANAGER for an example.

### DONE_BUTTON

Set this keyword to a string containing the text to use for the Done button label. If omitted, the text “Done with <filename>” is used.

### EDITABLE

Set this keyword to allow modifications to the text displayed in XDISPLAYFILE. Setting this keyword also adds a “Save” button in addition to the Done button.

### FONT

A string containing the name of the font to use. The font specified is a device font (an X Windows font on Motif systems; a TrueType or PostScript font on Windows systems). See About Device Fonts for details on specifying names for device fonts. If this keyword is omitted, the default font is used.

### GROUP

The widget ID of the widget that calls XDISPLAYFILE. If this keyword is specified, the death of the group leader results in the death of XDISPLAYFILE.

### GROW_TO_SCREEN

Set this keyword to cause XDISPLAYFILE to display as many lines of text as possible without making the display too tall to fit on the screen. If this keyword is set, the value specified by the HEIGHT keyword is taken to be the minimum number of lines to display.

### HEIGHT

The number of text lines that the widget should display at one time. If this keyword is not specified, 24 lines is the default.

### MODAL

Set this keyword to create the XDISPLAYFILE dialog as a modal dialog. Setting the MODAL keyword allows you to call XDISPLAYFILE from another modal dialog.

### RETURN_ID

Set this keyword equal to a named variable that will contain the widget ID of the top level base created by XDISPLAYFILE.

### TEXT

A string or string array to be displayed in the widget instead of the contents of a file. If this keyword is present, the Filename input argument is ignored (but is still required). String arrays are displayed one element per line.

### TITLE

A string to use as the widget title rather than the file name or “XDisplayFile”.

### WIDTH

The width of the widget display in characters. If this keyword is not specified, 80 characters is the default.

### WTEXT

Set this keyword to a named variable that will contain the widget ID of the text widget. This allows setting text selections and cursor positions programmatically. For example, the following code opens the XDISPLAYFILE widget and selects the first 10 characters of the file displayed in the text widget:

XDISPLAYFILE, 'myfile.txt', /EDITABLE, WTEXT=w

WIDGET_CONTROL, w, SET_TEXT_SELECT=[0, 10]

## Version History

Pre-4.0 | Introduced
6.2 | Added GROW_TO_SCREEN and RETURN_ID keywords

## See Also

PRINT/PRINTF