Difference between revisions of "Method globalCustomUIs"

From Ribbon Commander Documentation
Jump to: navigation, search
(VBA)
(Remarks)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
== Description ==
 
== Description ==
Static method that returns the {{collection}} of [[rxCustomUI]]s with [[rxDispatchScope | global dispatch]] in the current session.
+
(VBA-specific) Static method that returns the {{collection}} of [[rxCustomUI]]s with [[rxDispatchScope | global dispatch]] in the current session.
  
 
== Parameters ==
 
== Parameters ==
Line 9: Line 9:
 
# 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).
 
# 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.
 
# [[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]]).
+
# You can look-up [[rxCustomUI]] objects in the {{collection}} by contextId (see [[#Examples|Examples]]).
  
 
== Examples ==
 
== Examples ==
Line 46: Line 46:
 
      
 
      
 
End Sub
 
End Sub
</syntaxhighlight>
 
 
=== C# ===
 
<syntaxhighlight lang="csharp" line>
 
// Cache a reference to the default rxCustomUI of this session
 
rxCustomUI myCustomUI = rxCustomUI.defaultInstance
 
</syntaxhighlight>
 
 
=== VB.NET ===
 
<syntaxhighlight lang="vb" line>
 
' Cache a reference to the default rxCustomUI of this session
 
Dim myCustomUI As rxCustomUI = rxCustomUI.defaultInstance
 
</syntaxhighlight>
 
 
=== C++ ===
 
<syntaxhighlight lang="cpp" line>
 
 
</syntaxhighlight>
 
</syntaxhighlight>

Latest revision as of 21:22, 14 March 2013

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