XLL+ Class Library (6.3)

Advanced Features

This topic describes some of the advanced features of the extended user interface.

Changing the keyboard behavior

The default keyboard settings for the extended user interface are summarized below:

  Drop-down Popup
Shortcut Down arrow Alt+Enter
Behavior Ignored if the current value is a reference Always

The developer can change these keyboard settings, by using the XLWIZEXUI_KEYMAPPING structure returned by CXlWizExUIFunctionRegistry::GetKeyMapping(). The code below is called from the OnXllOpenEx() event, and changes the keyboard behavior as follows:

CopyC++
CXlWizExUIFunctionRegistry* pReg = CXlWizExUIFunctionRegistry::GetInstance();
PXLWIZEXUI_KEYMAPPING pMapping = pReg->GetKeyMapping(XLWIZEXUI_UITYPE_LIST);
pMapping->vk = VK_DOWN;
pMapping->vkModifier = VK_MENU;
pMapping->nBehavior = XLWIZEXUI_KEY_IF_EMPTY;

See CXlWizExUIFunctionRegistry::GetKeyMapping() for more details.

Dynamic lists

You may have lists of values that change over time, particularly lists that are stored in a database.

To change the memebers of a value list at run-time, you need to handle both aspects of a value list's behavior: (i) the drop-down lists in the extended UI and (ii) the input validation provided by the CXlValueListConstraint object.

Changing the items in a drop-down list

You can load a list dynamically by creating a new CXlWizExUIListProvider object, and then calling CXlWizExUIFunctionDescriptor::AddList to register the new list.

CopyC++
// Create a new list provider, and populate it.
CXlWizExUIListProvider* pProvider = new CXlWizExUIListProvider();
for (int i = 0; theList[i].description; i++)
    pProvider->Add(theList[i].value, theList[i].description);

// Get the single instance of the function registry, 
// find the affected function, 
// and apply the new list provider to the appropriate argument.
CXlWizExUIFunctionRegistry::GetInstance()
    ->FindAddFunctionDescriptor(_T("MyFunction"))
    ->AddList(0, pProvider);

Changing the items in a validation list

You can change the items in a value list used for validation, by calling CXlValueListConstraint::SetValues. Locate the CXlValueListConstraint instance that has been created by the XLL+ Function Wizard, and call SetValue with the new value list.

CopyC++
// Create a list of integer constraint values 
std::vector<long> constraintValues;
for (int i = 0; theList[i].description; i++)
    constraintValues.push_back(theList[i].value);

// Apply the new values to the constraint generated by 
// the XLL+ Function Wizard
xlvlc__MyFunction__Choice.SetValues(constraintValues.size(),
    &constraintValues[0]);

See the ExUIDynList sample for more details.

Next: Languages other than English >>