Difference between revisions of "Method globalCustomUIs"
From Ribbon Commander Documentation
(Created page with "{{Under Construction}}") |
(→Remarks) |
||
(11 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | {{ | + | == Description == |
+ | (VBA-specific) Static method that returns the {{collection}} of [[rxCustomUI]]s with [[rxDispatchScope | global dispatch]] in the current session. | ||
+ | |||
+ | == Parameters == | ||
+ | {{FuncTableBegin}} | ||
+ | {{FuncTableEnd}} | ||
+ | |||
+ | == Remarks == | ||
+ | # The default [[rxCustomUI]] of the session (see [[Method defaultInstance|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 [[Method create|rxCustomUI.create]] when [[rxDispatchScope | DispatchScope_global]] is used. | ||
+ | # You can look-up [[rxCustomUI]] objects in the {{collection}} by contextId (see [[#Examples|Examples]]). | ||
+ | |||
+ | == Examples == | ||
+ | |||
+ | === VBA === | ||
+ | <syntaxhighlight lang="vb" line> | ||
+ | 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 | ||
+ | </syntaxhighlight> |
Latest revision as of 21:22, 14 March 2013
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