All Cadcorp SIS API Methods

ShowUI Method

Description

Opens a SIS dialog to acquire user input, e.g. select an overlay or style or edit an expression etc.

Syntax

Visual Basic
Public Function ShowUI( _
   	ByVal ui As String, _
	ByVal parameters As String, _
) As String

Parameters

ui

The ui dialog to be opened:

  • "EditBrush"
  • "EditColourset"
  • "EditPen"
  • "EditExpression"
  • "PickOverlay"
  • "PickNolObject"
parameters
Optional parameters that can be supplied to initialise or customise the dialog.

Return Type

A string containing the user’s selection or input. The format varies on the ui option.

ui dialog Parameters

"EditBrush" & "EditColourset" & "EditPen"

Parameters can be any of:

  • Blank
  • A NOL object name
  • User-defined object in JSON format

Example

Dim penJson As String = sis.ShowUI("EditPen","")

This opens the Edit Pen dialog.

The returned value is a JSON-formatted string describing the Brush, Colourset or Pen as displayed in the UI dialog when OK is clicked.

If a NOL object name or JSON string is supplied as a parameter then the dialog will open showing that object definition as a starting point, e.g. to open the Edit Brush dialog showing the Blue brush:

Dim brushJson As String = sis.ShowUI("EditBrush","Blue")

"EditExpression"

Parameters can be:

  • Blank
  • The expression which is to be edited

Example

Dim exp As String = sis.ShowUI("EditExpression","_length/(speed#/0.0372833)")

This opens the expression builder with the specified expression in the input box.

The returned value is a string containing the edited expression.

"PickOverlay"

Parameters can be:

  • Blank
  • A JSON string defining the parameters (all are optional):
    • Title – a string containing the title to appear in the banner of the dialog
    • Status – a number in the range 0 - 3. This defines the minimum overlay status that can be selected.
    • Current – the position of the overlay to be pre-selected when the dialog opens.

Example

Dim rv As String = sis.ShowUI("PickOverlay",{""Title"":""My title"",""Status"":2, ""Current"":7}")

This opens the Overlay picker dialog with “My title” in the dialog’s banner. Overlay with index 7 is pre-selected in the dialog. OK can be clicked only if the selected overlay has a status of at least 2, i.e. hittable or editable.

The returned value is a JSON-formatted string containing the index of the selected overlay, e.g.

{"PickedOverlay":4}

"PickNolObject"

Parameters can be:

  • Blank
  • A JSON string defining the parameters:
    • Class – this parameter is mandatory it is a string containing the aclass value as used in the Named Object Library methods, e.g. "ABrush", "APen" etc.
    • Prefix – this can be used to set the root of the PickNolObject dialog, e.g. a NOL folder name (note, the prefix must include the trailing dot).
    • Select – the position of the overlay to be pre-selected when the dialog opens.
    • Title – a string containing the title to appear in the banner of the dialog.

Example

Dim rv As String = sis.ShowUI("PickNolObject",
"{""Class"":""APen"",""Prefix"":""OS MasterMap. "
",""Title"":""Pick a pen:"",""Select"":""primaryRouteDualCarriagewayLine""}”)

This opens the NOL object picker dialog for pens in the ‘OS MasterMap’ NOL folder and selects the pen called ‘primaryRouteDualCarriagewayLine’. The text in the dialog’s banner is "Pick a pen: "

The returned value is a JSON-formatted string containing the name of the object the user selects, e.g.

{"NolObject":OS MasterMap.motorwayLine}

Remarks

EvalUI should be used inside a try-catch statement as user-cancellation of the ui dialog is implemented as an exception.

The values for ui are case-sensitive strings.

Available: DK OD OM OV PySis

Group: