Advanced programming


You open modal dialogs with the "ShowDialog" method. All you have to do is add a design to  the "Partial View" category (" Global.ACUsages .DULayout"). Pass the design name in the second parameter:

ShowDialog(this, "MyDesignName");

The dialog receives the data context or BSOACComponent from the transferred instance that was transferred in the first parameter . Usually this is the this reference.

The following example shows a design with three buttons that is to be displayed via ShowDialog:

 

The last button is linked to the "CloseTopDialog" method, which is already declared in the ACComponent class itself. It ensures that the topmost modal dialog is closed.

The other two methods are declared in the business object itself:

 

"CloseTopDialog" is called within these methods. In addition, the local property "DialogResult" stores which key the user pressed and which material he selected in the ComboBox. You will now ask yourself, why is SelectedMaterial explicitly copied again into the property "DialogResult.ReturnValue"? Yes, this makes no sense within the business object itself, but DialogResult is returned in the following method:

 

This method is an auxiliary method to filter a filter on certain materials. The data records are fetched from the database with the Search () method . Then the modal dialog opens so that the user can select a material in the combo box. After one of the keys has been pressed, the dialog is closed and the program then returns the "DialogResult" in the last program line.

Perhaps you now guess why this method is needed:

 

"OpenMaterialBSO" is a method from another business object that requires material selection. To do this, it instantiates the above business object as a child instance and calls the "ShowDialogSelectMaterial" method.


You can also open designs as a modeless dialog. A dockable window belonging to the first surrounding DockingManager  is opened.

 ShowWindow(this, "Progress", false,
Global.VBDesignContainer.DockableWindow,
Global.VBDesignDockState.FloatingWindow,
Global.VBDesignDockPosition.Right);

As with opening a modal dialog, pass the reference to an ACComponent instance (usually the this pointer) and the name of the design that is to be displayed.

The last three parameters indicate where the DockingManger should display the window.


Input boxes are a simple alternative to modal dialogs. You do not need an explicit design for input boxes and they are opened using the message class :

 

The first parameter is a prompt. The second is a default value that is suggested. 

If the user should enter several values, then use the "InputBoxValues" method:

 

The first parameter is the dialog heading. The second parameter is a list of suggested values ​​and the third parameter contains the parameter labels. The number of elements must match the number of suggested values.