Rules for menu images

Menu images

If you have specified the image for the menu item through the ButtonImage property in the RibbonView tab in the menu painter, that image will be displayed in the corresponding ribbon item.

If no image is specified, for the contemporary style menu, the image specified by the MenuImage property of the menu item will be used, otherwise, the system default image will be displayed.

The following is the default image provided by the system.

Note

In ribbon bar and QuickAccessToolbar, GIF format images are not supported. Using GIF images may result in icons displaying with a black background. It is recommended to use other image formats such as BMP, PNG, etc., to avoid this issue.

For the optimal display effect, the ribbon items require the image at the appropriate size: the image for the ribbon panel, small button, and ribbon menu is 16*16 pixels, for large button is 32*32 pixels.

Please make sure the original menu images are at the appropriate size, or prepare new images whenever necessary.

Guidelines for setting images for RibbonView

The most recommended approach is to set the ButtonImage property in the menu painter > RibbonView tab for each menu item (including the 2nd-level, 3rd-level, and 4th-level menu items).

If you have not set the ButtonImage property in the RibbonView tab, then if the menu item has an image specified by the MenuImage property, that image will be used as the default, otherwise, a system image will be automatically displayed in RibbonView.

  • It is recommended to use LargeButton for frequently used buttons. Based on the actual display effect and ButtonSize, set the ButtonImage property in the RibbonView tab. The default width and height of the image for the small button is 16 * 16 pixels, for the large button is 32 * 32 pixels.

  • After setting the images for important menu items, you may need to dynamically set the ButtonImage property for other less important menu items in bulk.

    Such as setting the same default image for less important buttons. For example, in the MenuChange event of the MDI window, you can iterate through the menu items that do not have images set and assign a default image as needed.

    // Set default image for small buttons
    Long ll_count_level1, ll_index_level1, ll_index_level2, ll_count_level2
    Menu lm_current
    
     // Loop through the menu items (Categories)
     ll_count_level1 = UpperBound(am_menu.Item)
     For ll_index_level1 = 1 To ll_count_level1
       // Check if the current menu item has a submenu
       ll_count_level2 = UpperBound(am_menu.Item[ll_index_level1].Item[]) 
        If ll_count_level2 > 0 Then
          For ll_index_level2 = 1 To  ll_count_level2
            // 1. No sub item 2. No Menu Image 3. No Button Image 4. Small Button
            lm_current = am_menu.Item[ll_index_level1].Item[ll_index_level2]
            If UpperBound(lm_current.Item[]) = 0 And Trim(lm_current.MenuImage) = "" &
              And Trim(lm_current.Buttonimage) = "" And  lm_current.ButtonImageSize = 0 Then
              lm_current.MenuImage = as_image
            End If
          Next
        End If
    
Troubleshooting: Menu icons not displaying in RibbonView

When the DisplayMenuAsRibbonBar feature is enabled, internal system icons from the original menu do not display in the RibbonView.

Cause: The naming conventions for internal system icons in PowerBuilder 2017 were inconsistent -- some names included spaces and hyphens while others did not. In PowerBuilder 2019 R2 (build 2323) and later, these icons were renamed to a standardized format, removing spaces and hyphens. Consequently, the original names cannot be found in the Select Image dialog any more. However, although the original names cannot be located, they remain compatible and visible when used in the application; the only exception is the RibbonView.

Solution: To ensure system icons display in the RibbonView, use either of the following methods:

  • Manually update the internal system icons used in the menu to reflect their new names. If you need a complete list of the changed names, please contact support@appeon.com.

  • To locate the new icon names, perform a fuzzy search using the icon name without spaces and hyphens in the Select Image dialog.