Browser
Browser¶
Using a browser can be a good way to show records in a new window instead of showing them in the main explorers in Lime. This example opens a new browser for companies with a vba created filter as active. You can either choose to allow all filters for the class or specify a filter to use in the browser.
Code example¶
Sub OpenCompaniesInBrowser()
On Error GoTo ErrorHandler
Dim oClass As LDE.Class
Dim oBrowser As Lime.Browser
Dim oFilter As LDE.Filter
Dim oNewExplorer As Lime.Explorer
Dim oNewExplorerRecords As LDE.Records
Dim oNewExplorerSettings As LDE.Settings
Dim PageSize As Long
' We will open an explorer containing companies in our new browser
Set oClass = Application.Database.Classes.Item("company")
If Not oClass Is Nothing Then
Set oFilter = New LDE.Filter
Call oFilter.AddCondition("name", lkOpLike, "Lundalogik")
oFilter.Name = "Lundalogik"
' Let's use the application set limit on how many
' items we can display. Default is 0 i.e no limit
' at all
PageSize = Application.Settings.Read("Application\Explorer\PageSize", 0)
Set oNewExplorerRecords = New LDE.Records
Call oNewExplorerRecords.Open(oClass, , , PageSize)
' Create the browser
Set oBrowser = New Lime.Browser
oBrowser.Caption = oClass.LocalName
' Get settings for the explorer type we will create
Set oNewExplorerSettings = oBrowser.Explorers.Settings.Item(oClass.GUID)
' Create the new explorer and assign it settings, records and name. All
' these attributes are required by the explorer
Set oNewExplorer = New Lime.Explorer
Set oNewExplorer.Settings = oNewExplorerSettings
Set oNewExplorer.Records = oNewExplorerRecords
oNewExplorer.Name = oClass.LocalName
' Set filter and view as well. Use the ones associated with the
' explorer's class
Set oNewExplorer.Filters = oClass.Filters
'Call oNewExplorer.Filters.Add(oFilter)
Set oNewExplorer.Views = oClass.Views
' Make sure it's visible
Call oNewExplorerSettings.Write("Visible", 1)
' Put the explorer in search mode
Call oNewExplorerSettings.Write("SearchMode", 0)
'Set oNewExplorer.ActiveFilter = oFilter
' Add the explorer to the browser
Call oBrowser.Explorers.Add(oNewExplorer)
' Display it
Call oBrowser.show
Set oBrowser.ActiveExplorer.ActiveFilter = oFilter
End If
Exit Sub
ErrorHandler:
Call UI.ShowError("OpenCompaniesInBrowser")
End Sub
- Last modified: 5 years ago
- (external edit)