How to use the Selection dialog
In the POS, the Selection dialog is a generic dialog used to search for an entity and select one record which can be later used for other functionality. The Selection dialog can be customized to handle any kind of entity.
Constructor
Parameter | Description |
---|---|
ISelectionListView selectionList | Interface implementation that controls how data is displayed and filtered in the selection dialog |
string bannerText | The name of the banner to be displayed in the dialog |
bool inputRequired | If true, the cancel button will not be visible, making the selection of an entity mandatory |
bool standAlone | If true, the dialog will act as it's own windows and will be visible in the taskbar |
string initialSearch | Initial search value to be applied when the dialog is opened |
Usage
using (SelectionDialog dlg = new SelectionDialog(new DataEntitySelectionList(myData), Properties.Resources.SelectData, false, false))
{
if (dlg.ShowDialog() == DialogResult.OK)
{
DataEntity selectedEntity = (DataEntity)dlg.SelectedItem;
}
}
Implementing the ISelectionListView interface
In order to use the SelectionDialog with any kind of data, you need to create a class that implements the ISelectionListView interface for each data type. The class requires 3 main elements:
- The constructor which receives a list of the data to be displayed and saved in a private variable
- Implementation of LoadData(ListView listView, string filter = "") which has the responsibility of populating the data in the list view
- Implementation of SetupListViewHeader(ListView listView) which has the responsibility of adding the headers of the list view
For a complete example you can check the DataEntitySelectionList class.