Welcome to the Harris Geospatial documentation center. Here you will find reference guides and help documents.


  >  Docs Center  >  ENVI API  >  Processing  >  Style Sheets for User Interface Elements

Style Sheets for User Interface Elements

Style Sheets for User Interface Elements

If you create a custom task that displays a dialog for selecting parameters for an ENVITask or custom API script, you can include a style sheet to define the individual user interface (UI) elements. Examples of UI elements include file selection boxes, color pickers, and text boxes.

Normally if a custom task displays a dialog, the task will make a best guess at determining an appropriate UI element to display for a specific parameter. By specifying a style sheet, you have more flexibility in choosing UI elements for each input and output parameter for your custom task.

Style sheets consist of JSON-formatted text that maps task parameters to UI elements. See User Interface Elements for a complete list.

Here is a simple example of a style sheet:

{
   "schema": "envitask_3.2",
   "show_preview": false,
   "show_display_result": true,
   "parameters": [
     {
       "name": "raster_filename",
       "type": "IDLLabel_UI"
     }
   ]
}

Style Sheet Keys


This table describes the various fields (also called keys) in a style sheet.

Key

Description

schema

A string listing the version of ENVITask JSON schema that was used to write this task. The valid values are envitask_3.2, envitask_3.1 or envitask_3.0.

show_display_result

Set this key to true to display the Display result check box. Or set it to false to hide the check box.

show_preview

Set this key to true to display the Show Preview check box. Or set it to false to hide the check box.

show_read_more

Set this key to true to display the Read more hyperlink in the help dialog that displays when the user clicks the Help button. Or set it to false to remove the Read more text and hyperlink.

parameters

A container of key/value pairs, described in the Parameter Keys table below.

Parameter Keys


This table describes the keys that belong to the parameters group in a style sheet. Repeat for each parameter.

Key

Description

name

The name of the parameter. This name must exactly match the parameter name in the corresponding task template.

type

Set this key to the name of a UI element to display for the parameter. See User Interface Elements.

If you are unsure what type to specify and you want to see a preview, use the ENVIUI::CreateFromDialog method to display it. For example:

e = ENVI()
ui = e.UI
element = ENVIColorMapName_UI()
result = envi.ui.CreateFromDialog(element)

Steps to Create a Style Sheet


Follow these steps:

  1. Copy and paste the example above into a new text file.
  2. Repeat the parameters group for each input and output parameter in your custom task, then update the name and type keys. See the Parameter Keys table above.
  3. Save the template with a .style file extension to the same folder as the task file. If you save the template to another location, set the ENVIUI::SelectTaskParameters STYLE_SHEET keyword to point to that location.

When you run your custom task, the dialog will contain the new elements that you defined.

 



© 2019 Harris Geospatial Solutions, Inc. |  Legal
My Account    |    Store    |    Contact Us