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 in the lib/utilities subdirectory of the IDL distribution.


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]



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



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.


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.


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.


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 Using Device Fonts for details on specifying names for device fonts. If this keyword is omitted, the default font is used.


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.


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.


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


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.


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


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


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


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


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:


Version History




Added GROW_TO_SCREEN and RETURN_ID keywords

See Also