The CreateFromDialog function method displays a dialog containing a specified user interface (UI) element for selecting object or task parameters. It allows you to preview a user interface element when writing API scripts and custom tasks.


; Launch the application
e = ENVI()
; Get the UI object
UI = e.UI
; Display the ENVI Color Map Name UI element
c = ENVIColorMapName_UI()
result = UI.CreateFromDialog(c)


Issuing a PRINT command on result returns the currently selected color table:



Result = ENVIUI.CreateFromDialog (UserInterfaceElement [, Keywords=value])

Return Value

In most cases, this method returns the values specified by the end user. See the Return Value row in each table in the User Interface Elements topic.



Specify an object of the UI class you want to render. See User Interface Elements for a complete list.


ERROR (optional)

Set this keyword to a named variable that will contain any error message issued during execution of this routine. If no error occurs, the ERROR variable will be set to a null string (''). If an error occurs and the routine is a function, then the function result will be undefined.

When this keyword is not set and an error occurs, ENVI returns to the caller and execution halts. In this case, the error message is contained within !ERROR_STATE and can be caught using IDL's CATCH routine. See IDL Help for more information on !ERROR_STATE and CATCH.

See Manage Errors for more information on error handling in ENVI programming.

TEXT (optional)

Set this keyword to a string value with text to display in the dialog, for example:

TITLE (optional)

Set this keyword to a string value with the title for the dialog, for example:

Version History

ENVI 5.4


API Version


See Also

ENVIUI, User Interface Elements