Showing results for 
Search instead for 
Did you mean: 

shortcut key from menu on main window

Former Member
0 Kudos

Good day

I have windows of type main which have many resize events on the datawindows residing on it and space is tight.  It sits outside our main app container which has a menu control.

I require some of the shortcut key functionality we have there on these other windows without the menu being displayed.  Discovered the following code on the web although the menu control is indeed hidden it is still adjusting the height of the window (which cannot be any higher) and messing with my resize functionality.

Is there a way to stop the changemenu method from adjusting the height or indeed another means of solving this issue?

/* in order to make keyboard shortcuts available, create a hidden menu */

if not isvalid(this.menuid) Then

  ll_winheightadjust = this.height

   /* instantiate the menu */


   lm_id = this.menuid


  //this.ToolbarAlignment = AlignAtRight!

   /* hide the menu and it's first level items */

   lm_id.visible = false

   for ll_index = 1 to upperbound(lm_id.item)

      lm_id.item[ll_index].visible = false


  ll_winheightadjust = this.height - ll_winheightadjust // 152

end if

I tried initially the window event keydown, but I lose the shortcut if I jump to another application and return.

Does anyone have any ideas?

Thank you in advance


PowerBuilder 12.1, MS Windows 7

View Entire Topic
Former Member
0 Kudos

I think you can achieve what you are after If you make the menu items invisible in the menu painter and ChangeMenu in the Open event of the window.

Former Member
0 Kudos

Thank you Lars that worked!

As I am using an inherited menu object with multi submenu levels the solution is as follows:

In menu designer made sure all items are visible=false.

next in open event of window type main;

this.toolbarvisible = false

/* in order to make keyboard shortcuts available, create a hidden menu */

if not isvalid(this.menuid) Then



end if

Next I wrote a simple recursive function wf_menuinvisible() passing menu object with name am_rootmenuid

long ll_index

for ll_index = 1 to upperbound(am_rootmenuid.item)

  am_rootmenuid.item[ll_index].visible = false



return c#return.Success