1. Tracy Lamb
  2. PowerBuilder
  3. Friday, 8 April 2022 15:03 PM UTC

Hi all,

I'm trying to use the F9 key to trigger the pfc_operators event and open the Operators response window.  I created a user event on my dw named ue_keypress with arguments key (keycode) and keyflags (unsignedlong). Right now, the event just has a MessageBox so I know the event was triggered.

I can type the query operators into the dw when it's in query mode, and everything retireves just fine. But for some reason, my event isn't being triggered.  In theory, that event should be triggered with every keystroke in the dw.

Any suggestions?

~~~Tracy

Accepted Answer
John Fauss Accepted Answer Pending Moderation
  1. Saturday, 9 April 2022 04:43 AM UTC
  2. PowerBuilder
  3. # Permalink

Is the user event you created mapped to the pbm_dwnkeydown (DW Keydown) event? If it isn’t, the event will only be triggered when your code explicitly triggers it. 

Comment
  1. John Fauss
  2. Saturday, 9 April 2022 21:59 PM UTC
Any DW has this capability. When you create a new user event in the DW control, you create a mapped user event by opening the dropdown list just below the event argument fields. In that list, listed alphabetically, is this event. When selected, the event arguments will be filled in automatically.
  1. Helpful 1
  1. Tracy Lamb
  2. Sunday, 10 April 2022 18:45 PM UTC
Thank you John... when I created the new event, I didn't see the EventID field. Found it right where you said it is, but had to move the splitbar down a bit to see it. I tied my ue_keypress event to pbm_dwnkey and everything is working. I added the ue_keypress to u_dw because I use it so often. Also, as a side note, I over-ride the pfc_operators event in u_dw to pop-up my own operators window. Not sure if putting this in u_dw will affect performance in data-entry dw's... will test that next.

~~~Tracy

  1. Helpful
  1. John Fauss
  2. Sunday, 10 April 2022 23:32 PM UTC
That's great news, Tracy! I'm glad I could help.
  1. Helpful
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Saturday, 9 April 2022 17:24 PM UTC
  2. PowerBuilder
  3. # 1

If the window menu has an item with F9 as the shortcut and the item is hidden, the F9 key will still work and can trigger an event on the window which in turn triggers the event on the control.

Comment
  1. Tracy Lamb
  2. Saturday, 9 April 2022 21:55 PM UTC
That won't work as many of the windows I use the F9 key for are response windows.
  1. Helpful
  1. Chris Pollach @Appeon
  2. Saturday, 9 April 2022 22:48 PM UTC
FYI: Use the "ChangeMenu()" command to add a menu to any Response window class at runtime. The Menu does not have to be visible in order for the F9 mapping to work. ;-)
  1. Helpful
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.