1. kevin kevin rowe
  2. PowerBuilder
  3. Monday, 4 April 2022 14:32 PM UTC

We have a complex (400 item) menu built in PB 2017. This menu is also viewable as a tree view.

I am trying to convert the menu to a ribbonbar.

 

The security code for the menu looks hierarchically through the menu at the tag of each menu item and decides whether to enable that item or not.

 

I can see how to list and process the categories in the ribbonbar, but although the help says that it is a container, there are no methods to access the items in the container except by name.

Is there a way to grab the list of panels in a category, and the list of controls in a panel?

Once I have drilled down to the level of the buttons, I will be able to use the menu methods to list the menu items.

If this can't be done, the only other way I can think of doing this is to prune the xml file directly, and then load it.

 

 

Accepted Answer
Mark Lee @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 6 April 2022 09:51 AM UTC
  2. PowerBuilder
  3. # Permalink

Hi Kevin,

 

1. RibbonBar sub controls, such as the largebuttons and smallbuttons all support enabled, tag, and visible properties that match the menu item.
I suggest that you change your code logic and set the menu's tag to a unique identifier of each RibbonBar sub object + the security code.
Then you can parse the tag and use GetItemByTag to easily get the corresponding RibbonBar sub object, such as the category, largebutton, etc.

Please refer to the following link for details:
https://docs.appeon.com/pb2021/powerscript_reference/GetItemByTag_func.html

This way, you can avoid getting category or panel list in a loop.


2. If you still want to get the list of panels in a category or the list of controls in a panel, you can refer to these methods: GetCategoryByIndex, GetCategoryCount,GetChildItemByIndex and GetChildItemCount.


3. Currently, you can hard-code the RibbonBar or redraw it by loading a string, XML, or JSON.

More references for RIbbonBar:
https://docs.appeon.com/pb2021/pbug/Working_with_RibbonBar.html
https://docs.appeon.com/pb2021/pbug/Working_with_RibbonBar.html#Creating_a_RibbonBar
https://docs.appeon.com/pb2021/pbug/Working_with_RibbonBar.html#Replace_an_Application_Menu_with_a_RibbonBar

You can also refer to the RibbonBar Demo:
https://github.com/Appeon/PowerBuilder-RibbonBar-Example

 

Regards,

 

 

Comment
  1. kevin kevin rowe
  2. Friday, 22 April 2022 15:22 PM UTC
Thanks for all the answers given. I've built a set of functions that scan the ribbon by category and then examining each control in turn and then examining the menu items hierarchically, as suggested. We need to do this because the menu can be A) partially blocked by function license options and B) set by an administrator to a subset of the licensed features. If you are reading this for a how-to, remember that anything except a category or button cannot be placed directly back into the ribbonbar. Menu items into menus, menus into buttons, buttons into bar, in that order.
  1. Helpful 1
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Monday, 4 April 2022 15:59 PM UTC
  2. PowerBuilder
  3. # 1

Hi Kevin;

  Have you tried the GetCatergoryXxxx () commands for that?

Regards ... Chris

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.