To create a visualizer form, execute the following operations:
Create a form with the PluginViewForm identifier. This form must be inherited from the AdhocUserViewForm class.
Place the Label component with the Label_Plugin_Caption identifier at the top part of the form. Select this component and in the object inspector on the Properties tab delete values of the Text property, set the AutoSize property to True.
Add the UiErAnalyzer component with the UiErAnalyzer1 identifier to the form.
Add the ErAnalyzerDimPanel component with the ErAnalyzerDimPanel1 identifier to the left part of the form. Select this component and in the object inspector on the Properties tab select the UiErAnalyzer1 value for the Object property.
Add the ChartBox component with the ChartBox1 identifier to the right part of the form. Select this component and in the object inspector on the Properties tab select the UiErAnalyzer1 value for the Source property. The form should look as follows:
Add links to the Adhoc, Chart, Metabase, Xml system assemblies.
Set form code:
Public Class PluginViewFormForm: AdhocUserViewForm
UiErAnalyzer1: UiErAnalyzer;
ChartBox1: ChartBox;
ErAnalyzerDimPanel1: ErAnalyzerDimPanel;
Label_Plugin_Caption: Label;
{ Function to get types of supported data sources.
Implementation of AdhocUserViewForm.SupportedSource}
Function get_SupportedSource: Array Of Integer;
Var
SourcesKeys: Array Of Integer;
Begin
SourcesKeys := New Integer[1];
SourcesKeys[0] := MetabaseObjectClass.KE_CLASS_EXPRESSREPORT;
return sourcesKeys;
end Function get_SupportedSource;
{ Procedure of creating a plugin data source.
Implementation of AdhocUserViewForm.Source}
Sub set_Source(s: IAdhocDataSourceObject);
Var
Analyzer: IEaxAnalyzer;
Begin
SourceValue := s;
Analyzer := SourceValue.GetSourceObject As IEaxAnalyzer;
UiErAnalyzer1.ErAnalyzer := SourceValue.GetSourceObject As IEaxAnalyzer;
UiErAnalyzer1.ErAnalyzer.Chart.Active := True;
UiErAnalyzer1.Active := True;
End Sub set_Source;
{ Procedure to save plugin settings.
Implementation of AdhocUserViewForm.SaveSettings}
Sub SaveSettings(xml: Variant);
Var
el: IXmlDomElement;
Begin
el := xml As IXmlDomElement;
el.setAttribute("txt", Label_Plugin_Caption.Text);
End Sub SaveSettings;
{ Procedure to load plugin settings.
Implementation of AdhocUserViewForm.LoadSettings}
Sub LoadSettings(xml: Variant);
Var
el: IXmlDomElement;
Begin
el := xml As IXmlDomElement;
Label_Plugin_Caption.Text := el.getAttribute("txt") As string;
End Sub LoadSettings;
{ User procedure to set plugin caption.
It is used to interact with side panel tab}
Public Sub SetLabelText(val: string);
Begin
Label_Plugin_Caption.Text := val;
End Sub SetLabelText;
{ User function to get plugin caption.
It is used to interact with side panel tab}
Public Function GetLabelText: string;
Begin
Return Label_Plugin_Caption.Text;
End Function GetLabelText;
End Class PluginViewFormForm;
See also: