general()
This member function opens the general dialog panel. The content displayed is a given panel reference, which is called the dialog sub panel.
Synopsis
int DialogFramework::general( const mapping &options)
Parameter
Parameter | Description |
---|---|
options: | A mapping with the dialog properties. The following keys are supported: |
text | A text, which will be displayed in the dialog. |
title |
A text, which will be displayed as dialog header. There will be no title if NULL or an empty string is given. Default value: "" |
refFile |
File name of the dialog sub panel. This is the relative path to the panel reference from the "panels" folder. Default value: "objects/dialogFramework/dialog_subText.pnl" |
buttonTextOk |
A message catalogue key of general.cat or string used on the 1 (OK) button text. When NULL or an empty string is given, the button will be invisible. Default value: "" |
buttonTextNOk |
A message catalogue key of general.cat or string used on the 0 (cancel) button text. When NULL or an empty string is given, the button will be invisible. Default value: "close" |
icon |
A file name of an icon which will be shown in the dialog header. When NULL or an empty string is given, no icon will be shown. This is the relative path to the icon from the "pictures" folder. Default value: "" |
titleColor |
The color of the dialog header background. When NULL or an empty string is given, the title will have the default background color. Default value: "" |
helpLink |
The help page, which will be opened by pressing on the "Help" button. When NULL or an empty string is given, no help button is shown. This parameter is a file name. ( e.g.: "helpNote.txt" for the file <project_path>/help/<lang>/helpNote.txt). Default value: "" |
dollars | An additional dyn_string of dollar parameters, which will be passed to the dialog sub panel. |
Return Value
Returns the value associated with the selected button. This can be 0 when the "cancel" button is clicked, or 1 if the "ok" button is clicked.
Error
-
Description
This function opens the general dialog panel, adjusted with the parameters given in the mapping. For this dialog panel, the default dialog sub panel contains only a field to display text.
The parameters inside the mapping can be used to include local panels, icons, colors or catalog texts as parts of the dialog panel.
Example
The following example calls the general dialog panel with the header "Capacity" on a colored background with "Ok and "NOk" buttons. It opens a local panel "myCapacity.pnl", which contains a arc and a circle shape forming a pie-chart and text showing a capacity. The value of the capacity is passed to the dialog sub panel as a dollar parameter. The debug shows which button was pressed.
#uses "classes/DialogFramework"
main()
{
int answer;
answer = DialogFramework::general(makeMapping("title", "Capacity",
"text", "",
"refFile", "myCapacity.pnl",
"buttonTextOk", "OK",
"buttonTextNOk", "NOk",
"titleColor", "SiemensPetrol",
"dollars", makeDynString("$capacity:75")));
DebugN("Button pressed: " + answer);
}
WCCOAui1:
["Button pressed: 1"]
Assignment
Generic Dialog Framework
Availability
UI, CTRL
See also