Skip to content

CustomizeOptions Object

See Also

See Also

Description

Represents a customization object that allows you to customize how the CommandBar customization dialog is displayed. You can choose which pages to display in the dialog, and you can add your own custom controls to the right-click context menu that is displayed during button customization when a control is right-clicked. You even have the ability to delete existing controls from the context menu.

For a list of all members defined in this module, see CustomizeOptions members.

Object Model

Object Model
Image Manager Icons
Get Image
Context Menu

Remarks

CustomizeOptions can only be used within the Customization event.

The Customize dialog will allow the user to customize the toolbar and menu bar. The CommandBars.EnableCustomization(True) method must be called to enable customization.

Example

Customizing the CommandBar Customization Dialog and Context Menu (Visual Basic)

This sample illustrates how to customize the CommandBars Customization dialog and the context menu that is displayed when a user right-clicks on a control during customization. You will also see how to add your own custom images to the Change Button Icon popup in the context menu.

Private Sub CommandBars_Customization(ByVal Options As XtremeCommandBars.ICustomizeOptions)

    '==========================================================================================================
    '        Choose which pages to display in the customization dialog
    '==========================================================================================================

    ' Do not show the Keyboard page in the customization dialog
    Options.ShowKeyboardPage = False

    ' Do not show the Options page in the customization dialog
    Options.ShowOptionsPage = False

    '==========================================================================================================
    '        Add custom controls to the context menu that is displayed when a control is
    '        right-clicked during customization
    '==========================================================================================================

    ' Add an edit control to the context menu that is displayed when the user right-clicks a
    ' control during customization. Passing a 4 in as the "Before" parameter will insert this
    ' edit control as the fourth control in the context menu. The control will have a caption
    ' label of "Parameter." When this control is clicked, the execute event is fired and
    ' the control will have an Id of ID_EDIT_PARAM. See description of CustomizeOptions.ContextMenu
    ' and CommandBars.CustomizedControl for more information on adding control to the context menu.
    Options.ContextMenu.Controls.Add xtpControlEdit, ID_EDIT_PARAM, "Parameter", 4

    '==========================================================================================================
    '        Adding Images to the "Change Button Icon" popup in the context menu
    '==========================================================================================================

    ' This will illustrate how to add your own custom images to the "Change Button Image" popup
    ' that allows users to change the image of a control.

    ' Array of commands used to load images from a bitmap, this will be the value assigned to the
    ' controls IconId property. The images will be displayed in the "Change Button Image" popup of the customization context menu
    Dim ChangeButtonImageIconArray(0 To 7) As Long

    ' There are 8 icons in the Bitmap file, the bitmap file is 128x16,
    ' which contains 8 16x16 icons. You need to make sure that there is
    ' an element in the array for each icon in the Bitmap.
    ' Width of icons = Width of Bitmap / number of elements in array
    ' I.e. Width of icons = 128/8 = 16
    ' These values represent the IconId that will be assigned to the control, this
    ' allows you to determine which icon is being used for your controls.
    ' IconId cannot be Zero (0), so do not assign 0 to any of the array elements.
    ' IMPORTANT: The IconId must start with 1. So IconId = 1,2,3,4,5,....N
    ChangeButtonImageIconArray(0) = 1
    ChangeButtonImageIconArray(1) = 2
    ChangeButtonImageIconArray(2) = 3
    ChangeButtonImageIconArray(3) = 4
    ChangeButtonImageIconArray(4) = 5
    ChangeButtonImageIconArray(5) = 6
    ChangeButtonImageIconArray(6) = 7
    ChangeButtonImageIconArray(7) = 8

    ' Remove the "built-in" images provided with the suite
    Options.CustomIcons.RemoveAll

    ' Passing the ChangeButtonImageIconArray for the "Commands" parameter will add an icon to the collection
    ' of icons for each item in the array. So Number of icons added = Number of elements in array.
    ' Icon width = Total width of Bitmap/Number of elements in array.
    Options.CustomIcons.LoadBitmap App.Path & "\Icons\ChangeButtonIcons.bmp", ChangeButtonImageIconArray, xtpImageNormal

End Sub

See Also


Copyright (c) 1998-2024 Codejock Technologies. All rights reserved.