1. Gimmy Susan
  2. PowerBuilder
  3. Tuesday, 16 March 2021 11:22 AM UTC


Good morning Guru
I need to change the window menu, but something is not working for me.

Let's go in order.


I have a window with a menu I don't know the name of.
When certain conditions occur, I have to change the menu.
In the end I have to restore the original menu (whose name I didn't know)

I tried in the following way, but as you can see from the image as soon as I change the menu with changemenu the saving made goes to null.

=======================================

 

menu m_temp
m_temp = create menu
m_temp = parent.menuid
parent.changemenu(m_genapp_sheet2)
// code here
parent.changemenu(m_temp)

=======================================

 

 

Some idea?

Thanks in advance.
Gimmy

 

 

Ecosystem:

Window10 + pb2019r3

Attachments (1)
Accepted Answer
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 16 March 2021 17:00 PM UTC
  2. PowerBuilder
  3. # Permalink

Hi Gimmy;

   Unfortunately, the ChangeMenu() command only accepts an object (class) name and not a string variable with the class name.

   This would be a nice enhancement request IMHO. Say for example:

  • Menu   lo_mu_hold
  • Menu   lo_mu
  • String   ls_mu_old_name
  • String   ls_mu_new_name = "m_gimmy"
  • lo_mu_hold = Parent. menuid
  • ls_mu_old_name = lo_mu_hold.ClassName()
  • ChangeMenu ( ls_mu_new_name, lo_mu, 0 )
  • // processing
  • // ...
  • ChangeMenu ( ls_mu_old_name, lo_mu, 0 )

  Of course, this ChangeMenu() command syntax does not yet exist currently.  :-(

  I would suggest submitting an enhancement request.

Regards ... Chris

 

Comment
  1. Miguel Leeuwe
  2. Wednesday, 17 March 2021 22:58 PM UTC
yes, as Chris said: ChangeMenu needs a menu object that physically exists in one of your libraries.

regards
  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Thursday, 18 March 2021 17:46 PM UTC
  2. PowerBuilder
  3. # 1

Hi Gimmy;

   Thank you for submitting a Support Ticket for this as an enhancement request. It's now on its way to Engineering and Product Management. I added another suggestion (My $0.02 worth) on to that ticket as well for this feature enhancement.  ;-)

HTH

Regards ... Chris

Comment
There are no comments made yet.
Olan Knight Accepted Answer Pending Moderation
  1. Wednesday, 17 March 2021 19:56 PM UTC
  2. PowerBuilder
  3. # 2

The easiest workaround for this is to create a psarent menu with EVERYTHING on it, and hide the entries that are not normally used on the various inherited menus.

The unknown menu is now a descendant of the full blown parent menu.

Get a pointer to the menu, SHOW the options required, HIDE those no longer needed.

When you restore the "original menu", just reverse what you did in the previous step.


Olan

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.