Schultz’s PowerBuilder Notes

Using a Menu on a Response window to give you Key Short Keys


Aron wanted a datawindow to be able have all the standard windows shortcut key “<cntl> A” for “Select All”. He was using the PFC multi row select, so he was able to give the standard <Cntl> and <Shift> extended selection.

His solution was to use a hidden menu where the Select All menu item is triggered by the shortcut key “<Cntl> A”. This problem was complicated by the fact that the window was a Response window, and needed to have the menu assignment done dynamically. Here is the code he put in the PreOpen Event.

menu lm

// m_response_edit is menu inherited from m_frame

int i

// In order to make keyboard shortcuts available, create a hidden menu
If Not IsValid(This.menuId) Then
   // Instantiate the menu
   This.ChangeMenu(m_response_edit)
   lm = This.menuId

   // Hide the menu and it's first level items
   lm.visible = False
   For i = 1 To UpperBound(lm.item)
      lm.item[i].visible = False
   Next
End if

May 6, 2008 - Posted by | Menus | , , , , ,

1 Comment »

  1. Good tip. I think I did this once.

    Comment by Tom | May 9, 2008 | Reply


Leave a Reply