Difference between revisions of "Creating an rxCustomUI object with local dispatch scope in VBA"
From Ribbon Commander Documentation
(Created page with "== Prerequisites == We recommend you go through Creating our first button in VBA before getting into this example. == Background == {{Context Intro Background}}") |
|||
Line 4: | Line 4: | ||
== Background == | == Background == | ||
{{Context Intro Background}} | {{Context Intro Background}} | ||
+ | |||
+ | == Creating a new local context with a drop down == | ||
+ | * Create a new class module and name it --clsMyLocalContext-- |
Revision as of 20:24, 10 March 2013
Prerequisites
We recommend you go through Creating our first button in VBA before getting into this example.
Background
In previous examples we worked with the default rxCustomUI instance of the current session. This is fine for example code, but in real life it is preferable that each add-in/application creates its own context (or virtual add-in) to isolate its UI from other add-ins/applications.
The framework currently supports up to 1000 contexts/session so there are enough contexts to go around!
In VBA you can create rxCustomUI objects with two types of dispatch scopes (see rxCustomUI.create, make_delegate):
- Global dispatch. Intended to be used with VBA standard modules. Delegates created by the rxCustomUI object dispatch to public functions in standard VBA modules. The rxCustomUI object returned by the static function rxCustomUI.defaultInstance has global dispatch.
- Local context. Intended to be used with VBA classes. Delegates created by the rxCustomUI object dispatch to public methods of a user-supplied dispatch object, usually the owning class.
Creating a new local context with a drop down
- Create a new class module and name it --clsMyLocalContext--