An argument which has the setting Show popup in Formula Wizard set will present an ellipsis (...) button in the Excel Formula Wizard.
If the developer provides an object derived from CXlWizExUIPopupProviderBase, then a popup editor will be displayed when the user clicks on the ellipsis button.
A class derived from CXlWizExUIPopupProviderBase
must provide an implementation of the Edit
method,
as in the example below.
class CMyPopupProvider : public CXlWizExUIPopupProviderBase { public: virtual bool Edit(CString& strValue, HWND hwndParent) { CMyPopupDialog dlg(hwndParent, strValue); if (dlg.DoModal() == IDOK) { strValue = dlg.m_strValue; return true; } return false; } };
The Edit
method will be called when the button is pushed.
The method should implement the following steps:
strValue
).strValue
and return true
;
if the user cancels, return false
.For examples of how to implement a class derived from CXlWizExUIPopupProviderBase
,
see ExUIPopup sample,
ExUIPopupMfc sample
and ExUIPopupClr sample.
Once you have provided a class derived from
CXlWizExUIPopupProviderBase
, you should use a global instance of
CXlWizExUIArgumentPopupCreator
to register it.
CXlWizExUIArgumentPopupCreator myPopupCreator(_T("MyFunction"), 0, new CMyPopupProvider());
The code above attaches an instance of the CMyPopupProvider
provider class discussed above to the first argument of the add-in function
MyFunction
.
Note that you are responsible for constructing the instance of
CMyPopupProvider
, but the framework is responsible for
destroying it.
For this reason, if a destructor is provided for your provider class,
it must be declared as virtual
.