XLL+ Class Library (6.3)

Popup Editors

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.

CXlWizExUIPopupProviderBase

A class derived from CXlWizExUIPopupProviderBase must provide an implementation of the Edit method, as in the example below.

CopyC++
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:

  1. Create a dialog and populate it with the current value (strValue).
  2. Display the dialog.
  3. If the user makes a change, update 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.

CXlWizExUIArgumentPopupCreator

Once you have provided a class derived from CXlWizExUIPopupProviderBase, you should use a global instance of CXlWizExUIArgumentPopupCreator to register it.

CopyC++
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.

Next: Advanced Features >>