Method globalCustomUIs
From Ribbon Commander Documentation
(Redirected from Method globalContexts)
Contents
Description
(VBA-specific) Static method that returns the collection of rxCustomUIs with global dispatch in the current session.
Parameters
Parameter Name
|
Parameter Type
|
Default Value
|
Description
|
Remarks
- The default rxCustomUI of the session (see rxCustomUI.defaultInstance) is a read-only member of the collection (i.e. it can't be removed).
- rxCustomUI objects are added to the collection via method rxCustomUI.create when DispatchScope_global is used.
- You can look-up rxCustomUI objects in the collection by contextId (see Examples).
Examples
VBA
Public Sub TestGlobalCustomUIs()
' We are assuming that no rxCustomUI objects with global dispatch have
' been created in this session yet
' Print the number of global rxCustomUIs
' Prints 1; it's the session's default rxCustomUI (see rxCustomUI.defaultInstance)
Debug.Print rxCustomUI.globalCustomUIs.Count
' Create a new rxCustomUI with global dispatch scope.
' The rxCustomUI gets added to the global rxCustomUI collection uppon creation
Dim myCustomUI As rxCustomUI
Set myCustomUI = rxCustomUI.Create("my_context", "My Test UI", DispatchScope_global)
' Print the number of global rxCustomUIs (prints 2)
Debug.Print rxCustomUI.globalCustomUIs.Count
' Remove the rxCustomUI obj from the globals collection. Its lifetime is now tied to
' the scope of this function
' Lookup the customUI by contextId
Dim myCustomUI2 As rxCustomUI
Set myCustomUI2 = rxCustomUI.globalCustomUIs("my_context")
' Remove the obj from the collection
rxCustomUI.globalCustomUIs.Remove myCustomUI2
' Print the number of global rxCustomUIs (prints 1)
Debug.Print rxCustomUI.globalCustomUIs.Count
End Sub