Example (Custom Dialogs)

A small example is considered to illustrate how to create a form dialog.

The script prompts the user for an S-parameter result and graph title. The result is plotted on a new Smith chart.
app = pf.GetApplication()
-- ...
form = pf.Form.New("Simple Form Dialog") -- Create the dialog

-- Create the dialog's items
spResultSelector = pf.FormDataSelector.New("Select an S-parameter result", 
                                            pf.Enums.FormDataSelectorType.SParameter)

lineEdit = pf.FormLineEdit.New("The title of the chart")
lineEdit.Value = "Smith Chart"

-- Add the items to the dialog
form:Add(spResultSelector)
form:Add(lineEdit)
form:Run() -- Run the dialog

-- Extract and use the chosen values
smithChart = app.SmithCharts:Add()
smithChart.Title.Text = lineEdit.Value
smithChart.Traces:Add(spResultSelector.Value)
-- ...
The result of running the script is displayed in Figure 1 (when run with the “Horn” model from Feko Getting Started Guide).


Figure 1. Example of a simple form dialog.
Tip: For more information on the objects, properties and methods available for form dialogs, refer to Form and FormItem in the API reference.