====== Built-in dialogs ====== Lime CRM comes with a number of built-in dialogs that can be used for solving common tasks when customzing the application. Showing a dialog typically involves code along the following lines: Dim Dlg As New Lime.Dialog Dlg.Property("SomeSpecificProperty") = "DialogSpecificConfiguration" If Dlg.Show(DialogType) = vbOK Then ' User confirmed, continue with whatever End If Available dialog types are found in the ''DialogTypeEnum'' enumeration. Below the most common dialog types are shown together with a short code example demonstrating the capabilities of the dialog. ===== Search records (lkDialogSearchRecords) ===== This dialog can be used for searching for and picking records: {{:customization:vba:dialog-search-records.png?350}} ==== Properties ==== ^ Name ^ Required ^ Type ^ Description ^ | Class | Yes | LDE.Class | The type of records to search for. | | SearchFilter | No | LDE.Filter | Restricts the records the dialog can search in. | | SearchView | No | LDE.View | Specifies which fields to search in. This view can be overriden by the user through the advanced options. By default the dialog searches in the field "Description (System)" or the set of fields last used. | | SingleSelect | No | Boolean | If True only one record can be selected. Default value is False. __(Note: When singleselect is disabled the multi-select behaves oddly and requires a scroll on the mouse wheel to update properly.)__ | | DisableAdvanced | No | Boolean | If True the advanced settings will be disabled. Default value is False. | | AutoLoad | No | Boolean | If True the search result is loaded before the dialog is displayed. It will also disable the search function and the advanced options. Use in combination with a search filter or when you know the result is limited in numbers. The default value is False. | | Caption | No | String | Dialog caption. | | CloseButtonCaption | No | String | Close button caption. | | SearchResultCaption | No | String | Text displayed just above the search result. | | Pool | LDE.Pool | Output | Contains the IDs of selected records after the dialog has been closed. ==== Example ==== The following examples allows the user to pick one single person having last name "Smith" and upon return prints the full name of of the person in the immediate window. Dim oDlg As New Lime.Dialog Dim oFilter As New LDE.Filter oFilter.AddCondition "lastname", lkOpEqual, "Smith" oDlg.Property("Class") = Database.Classes.Item("person") oDlg.Property("SearchFilter") = oFilter oDlg.Property("Caption") = "Search for Mr. Smith" oDlg.Property("CloseButtonCaption") = "Pick him" oDlg.Property("SearchResultCaption") = "Select your favorite Mr. Smith." oDlg.Property("AutoLoad") = True oDlg.Property("SingleSelect") = True oDlg.Property("DisableAdvanced") = True If oDlg.show(lkDialogSearchRecords) = vbOK Then Dim oPersons As New LDE.Records Dim oRec As LDE.Record oPersons.Open Database.Classes.Item("person"), oDlg.Property("Pool"), "name" For Each oRec In oPersons Debug.Print oRec("name") Next End If