cancel
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 http://pbbraindump.wordpress.com/2008/05/06/using-a-menu-on-a-response-window-to-give-you-key-short-...and 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 */

   this.changemenu(m_helpmain)

   lm_id = this.menuid

  this.toolbarheight=0

  //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

   next

  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

Andy

PowerBuilder 12.1, MS Windows 7

Accepted Solutions (1)

Accepted Solutions (1)

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

  this.changemenu(m_helpmain)

  wf_menuinvisible(this.menuid)

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

  wf_menuinvisible(am_rootmenuid.item[ll_index])

next

return c#return.Success

Answers (0)