The FlashBox development environment component works with the Flash component of the GANTT chart used to work with Web applications. To provide associations of the chart and other objects of application system the identifier of the current process is required. It can be done in two ways:
By processing commands of the FlashBox.OnFSCommand event or by executing the CallFunction method for the object placed in the FlashBox container.
See below the examples that allow to receive XML line that contains identifier and name of the process selected in the Grantt chart. Their execution requires a form and the FlashBox component with the FlashBox1 identifier and a button with the Button1 identifier. The Grantt chart should be loaded to FlashBox1.
The FlashBox.OnFSCommand event occurs when the Flash object receives a command. Argument of the onProcessSelect command returns the xml line that contains identifier and name of the process.
Sub FlashBox1OnFSCommand(Sender: Object; Args: IFlashBoxCommandEventArgs);
Begin
If Args.Command = "onProcessSelect" Then
Debug.WriteLine(Args.Args);
End If;
End Sub FlashBox1OnFSCommand;
If the process is changed on the Grantt chart during the work with running form, the xml line that contains identifier and name is displayed in the console window.
User can receive the xml line that contains identifier and name of the process selected in the Grantt chart, if he executes the CallFunction method for the object placed in the FlashBox container. To do it use the Invoke method, necessary parameters of which are specified in the example:
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
FlashObj: Variant;
Xml: String;
Begin
FlashObj := FlashBox1.OleObject;
Xml := FlashObj.Invoke("CallFunction", "<invoke name=""getSelectedProcess"" returntype=""xml""><arguments></arguments></invoke>");
Debug.WriteLine(Xml);
End Sub Button1OnClick;
The example is executed on clicking the button. If the process is selected on the Grantt chart, the XML line that contains identifier and name is displayed in the console window. If the process is not selected on the chart, <undefined/> line is displayed in the console window.
See also: