1. Thierry Garrigues
  2. PowerBuilder Beta
  3. Friday, 6 March 2020 14:52 PM

Hi
I create a Ribbonbar from a xml file. This one contains a menu associated with a Largebutton ("tag = mybutton"). I want to change the text of the 1st menu with the following code:

long ll_ret
RibbonLargeButtonItem lr_button
ll_ret = uo_ribbonbar.GetItemByTag( "mybutton", lr_button )

ribbonmenu lr_menu
ll_ret = uo_ribbonbar.getMenubybuttonhandle(lr_button.itemhandle, lr_menu)

ribbonmenuitem lr_item
ll_ret = lr_menu.getItem(1, lr_item)

lr_item.text += "!"

ll_ret = lr_menu.setitem(1, lr_item)

ll_ret = lr_button.setmenu(lr_menu )

I have no mistake but the text of the 1st menu is not changed. What have I forgotten? »

Thank for help

Regard

Thierry

xml file :

...

<LargeButton Text="Test" Tag="mybutton">
<Menu>
<Item Text="mymenu" Clicked="pfc_clicked" />
</Menu>
</LargeButton>

...

Accepted Answer
Mark Lee @Appeon Accepted Answer Pending Moderation
  1. Saturday, 7 March 2020 02:18 AM
  2. PowerBuilder Beta
  3. # Permalink
2
Votes
Undo

Hi Thierry,

 

Thanks for reporting this problem.

You need to add the following code to the end of your script in order to make the LargeButton update the new value in the Ribbon bar control:

uo_ribbonbar.setlargebutton(lr_button.itemhandle, lr_button)

 

long ll_ret
RibbonLargeButtonItem lr_button
ll_ret = uo_ribbonbar.GetItemByTag( "mybutton", lr_button )

ribbonmenu lr_menu
ll_ret = uo_ribbonbar.getMenubybuttonhandle(lr_button.itemhandle, lr_menu)

ribbonmenuitem lr_item
ll_ret = lr_menu.getItem(1, lr_item)

lr_item.text += "!"

ll_ret = lr_menu.setitem(1, lr_item)

ll_ret = lr_button.setmenu(lr_menu )

uo_ribbonbar.setlargebutton(lr_button.itemhandle, lr_button)

 

Regards,

Comment
Thanks a lot. Solved my issue as well
  1. Hua Yan
  2. Thursday, 12 March 2020 18:16 PM
There are no comments made yet.
Thierry Garrigues Accepted Answer Pending Moderation
  1. Monday, 9 March 2020 09:12 AM
  2. PowerBuilder Beta
  3. # 1
0
Votes
Undo

It works well, thanks

Regards

Thierry

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.