Public Member Functions | List of all members
SimpleDialogBox Class Reference

SimpleDialogBox class The class can be called from Application class. Creates a user-definable dialog box to collect values during the running of a script.
. More...

Public Member Functions

void AddAxisSelection (String &originName, String &vectorName, String &label, int col=0, int colSpan=1)
 Adds axis selection panel to allow selection of edges. More...
 
void AddCheckBox (String &name, String &label, bool defaultValue, int col=0, int colSpan=1)
 Adds a check box field to the dialog. More...
 
void AddComboBox (String &name, String &label, StringList &list, int defaultIndex=0, int col=0, int colSpan=1)
 Adds a combo box to a dialog. More...
 
void AddDirectoryPath (String &name, String &label, String &path, int col=0, int colSpan=1)
 Adds a filename field to the dialog for a directory name. More...
 
void AddInteger (String &name, String &label, int defaultvalue, int col=0, int colSpan=1)
 Adds an integer field to the dialog. More...
 
void AddIntegerList (String &name, String &label, String &defaultValue, int col=0, int colSpan=1)
 Adds an integer list field to the dialog. More...
 
void AddLabel (String &text, int col=0, int colSpan=1)
 Adds a text label to the dialog. More...
 
void AddLine (int col=0, int colSpan=1)
 Adds a horizontal line to the dialog. More...
 
void AddOpenFilename (String &name, String &label, String &path, String &filters, int col=0, int colSpan=1)
 Adds a filename field to the dialog for existing files. More...
 
void AddRadio (String &name, String &label, int value, int col=0, int colSpan=1)
 Adds a radio field to the dialog. More...
 
void AddReal (String &name, String &label, double defaultValue, int col=0, int colSpan=1)
 Adds a real valued field to the dialog. More...
 
void AddSaveFilename (String &name, String &label, String &path, String &filters, int col=0, int colSpan=1)
 Adds a filename field to the dialog for saving files. More...
 
void AddSelectEdgeList (String &name, String &label, int col=0, int colSpan=1)
 Adds an edge selection field to the dialog for a directory name. More...
 
void AddSelectFaceList (String &name, String &label, int col=0, int colSpan=1)
 Adds a face selection field to the dialog for a directory name. More...
 
void AddSelectPartList (String &name, String &label, int col=0, int colSpan=1)
 Adds a part selection field to the dialog for a directory name. More...
 
void AddSelectVertexList (String &name, String &label, int col=0, int colSpan=1)
 Adds a vertex selection field to the dialog for a directory name. More...
 
void AddSpinBox (String &name, String &label, int defaultValue, int col=0, int colSpan=1)
 Adds a spin box for getting an integer parameter to the dialog. More...
 
void AddString (String &name, String &label, String &defaultValue, int col=0, int colSpan=1)
 Adds a text field to the dialog. More...
 
Variant GetMeshGroupIndices (String &name)
 Returns the indices of mesh group selected in the field of the parameter as integer list. More...
 
PointGetPoint (String &name)
 Returns a point by its name. More...
 
Variant GetSetIndices (String &name)
 Returns the indices of Set selected in the field of the parameter as integer list. More...
 
Variant GetValue (String &name)
 Returns the value of a parameter. More...
 
Variant GetValueAsIntegerList (String &name)
 Returns the value of a parameter as integer list. More...
 
bool IsValid ()
 Returns True if an object is valid. More...
 
void SetCancelButtonVisible (bool visible)
 Specifies the visibility of Cancel button. More...
 
void SetHelp (String &helpString)
 Specifies a help string that will be displayed when the Help button on the dialog is pressed.
 
void SetHelpKey (String &helpKey)
 Since this is an internal function, it is not officially supported.
 
void SetMaximum (String &name, Variant &value)
 Specifies the maximum value of a field. More...
 
void SetMinimum (String &name, Variant &value)
 Specifies the minimum value of a field. More...
 
void SetModal (bool on)
 Specifies the dialog pops up as modal or modeless. More...
 
void SetTitle (String &dialogTitle)
 Specifies the title of the dialog window.
 
void SetTooltip (String &name, String &tooltip, int value=-1)
 Specifies a tooltip on the named field. More...
 
void SetTranslation (String &english, String &japanese)
 Specifies the label text when Japanese is selected as the JMAG display language. More...
 
int Show ()
 Shows the dialog box. Returns 1 on OK, 0 on Cancel.
 
bool WasCancelled ()
 Returns True if the cancel button was pressed.
 

Detailed Description

SimpleDialogBox class The class can be called from Application class. Creates a user-definable dialog box to collect values during the running of a script.
.

Example of calling the class object:

1 d = app.CreateDialogBox()
2 d.AddIngeter("param", "An integer value", 0)
3 d.Show()
4 v = d.GetValue("param")

Member Function Documentation

void SimpleDialogBox::AddAxisSelection ( String &  originName,
String &  vectorName,
String &  label,
int  col = 0,
int  colSpan = 1 
)

Adds axis selection panel to allow selection of edges.

Parameters
originNameThe name of the origin that will be used to retrieve its coordinates
vectorNameThe name of the vector that will be used to retrieve its coordinates
labelThe text that will appear in the label
colThe column of the dialog where the line should be positioned
colspanThe number of dialog columns the line should cover
void SimpleDialogBox::AddCheckBox ( String &  name,
String &  label,
bool  defaultValue,
int  col = 0,
int  colSpan = 1 
)

Adds a check box field to the dialog.

The name should be unique.
The name is passed to GetValue() to get the parameter value after the dialog has been shown.
It is also used with SetTooltip().

Parameters
nameThe name of the parameter
labelThe text that will appear in the label
defaultValueThe initial state of the checkbox
colThe column of the dialog where the label should be positioned
colspanThe number of dialog columns the label should cover
void SimpleDialogBox::AddComboBox ( String &  name,
String &  label,
StringList &  list,
int  defaultIndex = 0,
int  col = 0,
int  colSpan = 1 
)

Adds a combo box to a dialog.

The name should be unique.
The name is passed to GetValue to get the parameter value after the dialog has been shown.
It is also used with SetTooltip.
The return value of the GetValue method is the index of the selected item.

Parameters
nameThe name of the parameter
labelThe text that will appear in the label
listThe list of strings to be set in the combo box
defaultValueThe index of the item to be displayed by default in combo box, initial value of parameter
colThe column number of the dialog where the label should be positioned
colspanThe number of dialog columns the label should cover
void SimpleDialogBox::AddDirectoryPath ( String &  name,
String &  label,
String &  path,
int  col = 0,
int  colSpan = 1 
)

Adds a filename field to the dialog for a directory name.

The filename field has a browse button to launch the open directory dialog.
The name should be unique. The name is passed to GetValue() to get the parameter value after the dialog has been shown.
It is also used with SetTooltip() .

Parameters
nameThe name of the parameter
labelThe text that will appear in the label
pathThe initial path used in the directory dialog
colThe column number of the dialog where the label should be positioned
colspanThe number of dialog columns the label should cover
void SimpleDialogBox::AddInteger ( String &  name,
String &  label,
int  defaultvalue,
int  col = 0,
int  colSpan = 1 
)

Adds an integer field to the dialog.

The name should be unique.
The name is passed to GetValue() to get the parameter value after the dialog has been shown.
It is also used with SetTooltip(), SetMinimum() and SetMaximum().

Parameters
nameThe name of the parameter
labelThe text that will appear in the label
defaultValueThe initial value that will appear in the text box
colThe column of the dialog where the label should be positioned
colspanThe number of dialog columns the label should cover
void SimpleDialogBox::AddIntegerList ( String &  name,
String &  label,
String &  defaultValue,
int  col = 0,
int  colSpan = 1 
)

Adds an integer list field to the dialog.

The name should be unique.
The name is passed to GetValue() to get the parameter value after the dialog has been shown.
It is also used with SetTooltip().

Parameters
nameThe name of the parameter
labelThe text that will appear in the label
defaultValueThe initial value that will appear in the text box
colThe column of the dialog where the label should be positioned
colspanThe number of dialog columns the label should cover
void SimpleDialogBox::AddLabel ( String &  text,
int  col = 0,
int  colSpan = 1 
)

Adds a text label to the dialog.

Parameters
textThe text that will appear in the label
colThe column of the dialog where the label should be positioned
colspanThe number of dialog columns the label should cover
void SimpleDialogBox::AddLine ( int  col = 0,
int  colSpan = 1 
)

Adds a horizontal line to the dialog.

Parameters
colThe column of the dialog where the line should be positioned
colspanThe number of dialog columns the line should cover
void SimpleDialogBox::AddOpenFilename ( String &  name,
String &  label,
String &  path,
String &  filters,
int  col = 0,
int  colSpan = 1 
)

Adds a filename field to the dialog for existing files.

The filename field has a browse button to launch the file open dialog.
The name should be unique.
The name is passed to GetValue() to get the parameter value after the dialog has been shown.
It is also used with SetTooltip() .
The filter string contains a list of filetypes and wildcards, eg

{*.py}
d.AddOpenFilename("param", "Filename:", "", "Any File (*.*)")
Parameters
nameThe name of the parameter
labelThe text that will appear in the label
pathThe initial path used in the file open dialog
filtersThe file type and filter string
colThe column number of the dialog where the label should be positioned
colspanThe number of dialog columns the label should cover
void SimpleDialogBox::AddRadio ( String &  name,
String &  label,
int  value,
int  col = 0,
int  colSpan = 1 
)

Adds a radio field to the dialog.

The names of all radio buttons in a single group should have the same name.
The name is passed to GetValue() to get the parameter value after the dialog has been shown.
For a radio button group, the value returned by GetValue() will be the value passed in this function for the radio button that is selected.
To set a tooltip on a radio button, also pass the value to the SetTooltip():

1 d.AddRadio("param", "Label One", 1)
2 d.AddRadio("param", "Label Two", 2)
3 d.SetTooltip("param", "Tooltip one", 1)
4 d.SetTooltip("param", "Tooltip two", 2)
Parameters
nameThe name of the parameter
labelThe text that will appear in the label
valueThe value associated with this button
colThe column of the dialog where the label should be positioned
colspanThe number of dialog columns the label should cover
void SimpleDialogBox::AddReal ( String &  name,
String &  label,
double  defaultValue,
int  col = 0,
int  colSpan = 1 
)

Adds a real valued field to the dialog.

The name should be unique.
The name is passed to GetValue() to get the parameter value after the dialog has been shown.
It is also used with SetTooltip(), SetMinimum() and SetMaximum().

Parameters
nameThe name of the parameter
labelThe text that will appear in the label
defaultValueThe initial value that will appear in the text box
colThe column of the dialog where the label should be positioned
colspanThe number of dialog columns the label should cover
void SimpleDialogBox::AddSaveFilename ( String &  name,
String &  label,
String &  path,
String &  filters,
int  col = 0,
int  colSpan = 1 
)

Adds a filename field to the dialog for saving files.

The filename field has a browse button to launch the file save dialog.
The name should be unique.
The name is passed to GetValue() to get the parameter value after the dialog has been shown.
It is also used with SetTooltip() .
The filter string contains a list of filetypes and wildcards, eg

{*.py}
d.AddSaveFilename("param", "Filename:", "", "Any File (*.*)")
Parameters
value
nameThe name of the parameter
labelThe text that will appear in the label
pathThe initial path used in the file save dialog
filtersThe file type and filter string
colThe column number of the dialog where the label should be positioned
colspanThe number of dialog columns the label should cover
void SimpleDialogBox::AddSelectEdgeList ( String &  name,
String &  label,
int  col = 0,
int  colSpan = 1 
)

Adds an edge selection field to the dialog for a directory name.

The edge selection field has Edit, Delete, Highlight All, Create Sets, Select Sets and Mesh Groups buttons.
The name should be unique. The name is passed to GetValueAsIntegerList() to get the parameter value and GetSetIndices() to get the set indices and GetMeshGroupIndices() to get the selected mesh group indices after the dialog has been shown.
It is also used with SetTooltip() .

Parameters
nameThe name of the parameter
labelThe text that will appear in the label
colThe column number of the dialog where the label should be positioned
colspanThe number of dialog columns the label should cover
void SimpleDialogBox::AddSelectFaceList ( String &  name,
String &  label,
int  col = 0,
int  colSpan = 1 
)

Adds a face selection field to the dialog for a directory name.

The face selection field has Edit, Delete, Highlight All, Create Sets, Select Sets and Mesh Groups buttons.
The name should be unique. The name is passed to GetValueAsIntegerList() to get the parameter value and GetSetIndices() to get the set indices and GetMeshGroupIndices() to get the selected mesh group indices after the dialog has been shown.
It is also used with SetTooltip() .

Parameters
nameThe name of the parameter
labelThe text that will appear in the label
colThe column number of the dialog where the label should be positioned
colspanThe number of dialog columns the label should cover
void SimpleDialogBox::AddSelectPartList ( String &  name,
String &  label,
int  col = 0,
int  colSpan = 1 
)

Adds a part selection field to the dialog for a directory name.

The part selection field has Edit, Delete, Highlight All, Create Sets, Select Sets and Mesh Groups buttons.
The name should be unique. The name is passed to GetValueAsIntegerList() to get the parameter value and GetSetIndices() to get the set indices and GetMeshGroupIndices() to get the selected mesh group indices after the dialog has been shown.
It is also used with SetTooltip() .

Parameters
nameThe name of the parameter
labelThe text that will appear in the label
colThe column number of the dialog where the label should be positioned
colspanThe number of dialog columns the label should cover
void SimpleDialogBox::AddSelectVertexList ( String &  name,
String &  label,
int  col = 0,
int  colSpan = 1 
)

Adds a vertex selection field to the dialog for a directory name.

The vertex selection field has Edit, Delete, Highlight All, Create Sets, Select Sets and Mesh Groups buttons.
The name should be unique. The name is passed to GetValueAsIntegerList() to get the parameter value and GetSetIndices() to get the set indices and GetMeshGroupIndices() to get the selected mesh group indices after the dialog has been shown.
It is also used with SetTooltip() .

Parameters
nameThe name of the parameter
labelThe text that will appear in the label
colThe column number of the dialog where the label should be positioned
colspanThe number of dialog columns the label should cover
void SimpleDialogBox::AddSpinBox ( String &  name,
String &  label,
int  defaultValue,
int  col = 0,
int  colSpan = 1 
)

Adds a spin box for getting an integer parameter to the dialog.

The name should be unique.
The name is passed to GetValue() to get the parameter value after the dialog has been shown.
It is also used with SetTooltip(), SetMinimum() and SetMaximum().
For a spinbox the minimum and maximum values will determine the range of values that can be entered into the spin box.

Parameters
nameThe name of the parameter
labelThe text that will appear in the label
defaultValueThe initial value that will appear in the spin box
colThe column of the dialog where the label should be positioned
colspanThe number of dialog columns the label should cover
void SimpleDialogBox::AddString ( String &  name,
String &  label,
String &  defaultValue,
int  col = 0,
int  colSpan = 1 
)

Adds a text field to the dialog.

The name should be unique.
The name is passed to GetValue() to get the parameter value after the dialog has been shown.
It is also used with SetTooltip(), SetMinimum() and SetMaximum().

Parameters
nameThe name of the parameter
labelThe text that will appear in the label
defaultValueThe initial string that will appear in the text box
colThe column of the dialog where the label should be positioned
colspanThe number of dialog columns the label should cover
Variant SimpleDialogBox::GetMeshGroupIndices ( String &  name)

Returns the indices of mesh group selected in the field of the parameter as integer list.

Parameters
nameThe name of the parameter
Point * SimpleDialogBox::GetPoint ( String &  name)

Returns a point by its name.

Parameters
nameThe name of the point to get
Returns
Point object
Variant SimpleDialogBox::GetSetIndices ( String &  name)

Returns the indices of Set selected in the field of the parameter as integer list.

Parameters
nameThe name of the parameter
Variant SimpleDialogBox::GetValue ( String &  name)

Returns the value of a parameter.

Parameters
nameThe name of the parameterSel
Variant SimpleDialogBox::GetValueAsIntegerList ( String &  name)

Returns the value of a parameter as integer list.

Parameters
nameThe name of the parameter
bool SimpleDialogBox::IsValid ( )

Returns True if an object is valid.

Returns
Whether or not the SimpleDialogBox objects in the list are valid
void SimpleDialogBox::SetCancelButtonVisible ( bool  visible)

Specifies the visibility of Cancel button.

Parameters
visible
True=1 : Visible
False=0 : Hidden
void SimpleDialogBox::SetMaximum ( String &  name,
Variant &  value 
)

Specifies the maximum value of a field.

For integer and real fields the minimum and maximum values are used to limit the possible values that can be entered in the text box.
For spin boxes the minimum and maximum values determine the range of the spin box.

Parameters
nameThe name of the parameter to apply the limit to.
valueThe maxiumum value that should be entered
void SimpleDialogBox::SetMinimum ( String &  name,
Variant &  value 
)

Specifies the minimum value of a field.

For integer and real fields the minimum and maximum values are used to limit the possible values that can be entered in the text box.
For spin boxes the minimum and maximum values determine the range of the spin box.

Parameters
nameThe name of the parameter to apply the limit to
valueThe minimum value that should be entered
void SimpleDialogBox::SetModal ( bool  on)

Specifies the dialog pops up as modal or modeless.

Parameters
visible
True=1 : Modal
False=0 : Modeless
void SimpleDialogBox::SetTooltip ( String &  name,
String &  tooltip,
int  value = -1 
)

Specifies a tooltip on the named field.

Parameters
nameThe name of the parameter where the tooltip should be set
tooltipThe tooltip string
valueUsed for radio buttons only. See the AddRadio() function for details.
void SimpleDialogBox::SetTranslation ( String &  english,
String &  japanese 
)

Specifies the label text when Japanese is selected as the JMAG display language.

Use SetTranslation() when both English and Japanese are used as the display language.

  • When English is selected as the display language, the label text specified by the english argument is displayed as is.
  • When Japanese is selected as the display language, the label text specified by the english argument is replaced by the label text specified by the japanese argument. When only English or only Japanese is used as the display language, there is no need to use SetTranslation() . In addition, SetTranslation() cannot be used for text specified by the defaultValue argument of AddString() .
                \param english Label text when JMAG display language is English
                \param japanese Label text when JMAG display language is Japanese
    

The following is an example:

1 d = app.CreateDialogBox()
2 test = "aaa"
3 test_jp = "bbb"
4 d.SetTranslation(test, test_jp)
5 d.AddLabel(test)