Method globalCustomUIs

From Ribbon Commander Documentation
Jump to: navigation, search

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

  1. The default rxCustomUI of the session (see rxCustomUI.defaultInstance) is a read-only member of the collection (i.e. it can't be removed).
  2. rxCustomUI objects are added to the collection via method rxCustomUI.create when DispatchScope_global is used.
  3. You can look-up rxCustomUI objects in the collection by contextId (see Examples).

Examples

VBA

  1. Public Sub TestGlobalCustomUIs()
  2.  
  3.     ' We are assuming that no rxCustomUI objects with global dispatch have
  4.     ' been created in this session yet
  5.  
  6.     ' Print the number of global rxCustomUIs
  7.     ' Prints 1; it's the session's default rxCustomUI (see rxCustomUI.defaultInstance)
  8.     Debug.Print rxCustomUI.globalCustomUIs.Count
  9.  
  10.     ' Create a new rxCustomUI with global dispatch scope.
  11.     ' The rxCustomUI gets added to the global rxCustomUI collection uppon creation
  12.     Dim myCustomUI As rxCustomUI
  13.     Set myCustomUI = rxCustomUI.Create("my_context", "My Test UI", DispatchScope_global)
  14.  
  15.     ' Print the number of global rxCustomUIs (prints 2)
  16.     Debug.Print rxCustomUI.globalCustomUIs.Count
  17.  
  18.     ' Remove the rxCustomUI obj from the globals collection. Its lifetime is now tied to
  19.     ' the scope of this function
  20.  
  21.     ' Lookup the customUI by contextId
  22.     Dim myCustomUI2 As rxCustomUI
  23.     Set myCustomUI2 = rxCustomUI.globalCustomUIs("my_context")
  24.  
  25.     ' Remove the obj from the collection
  26.     rxCustomUI.globalCustomUIs.Remove myCustomUI2
  27.  
  28.     ' Print the number of global rxCustomUIs (prints 1)
  29.     Debug.Print rxCustomUI.globalCustomUIs.Count
  30.  
  31. End Sub