The FlashBox development environment component works with the Flash component of the Gantt chart that is 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 enable the user to get the XML string that contains identifier and name of the process selected in the Gantt chart. Their execution requires a form and the FlashBox component with the FlashBox1 identifier and a button with the Button1 identifier. The Gantt chart must be loaded to FlashBox1.
The FlashBox.OnFSCommand event occurs when the Flash object gets a command. Argument of the onProcessSelect command returns the XML string 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 selected on the Gantt chart during the work with running form, the XML string that contains identifier and name is displayed in the console window.
The user can receive the XML string that contains identifier and name of the process selected in the Gantt chart if he executes the CallFunction method for the object placed in the FlashBox container. To do this, use the Invoke method, which necessary parameters 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;
Click the button to start executing the example. If the process is selected on the Gantt chart, the XML string that contains identifier and name is displayed in the console window. If the process is not selected on the chart, the <undefined/> string is displayed in the console window.
See also: