1. Eduardo G.
  2. PowerBuilder
  3. Tuesday, 30 November 2021 12:07 PM UTC

Good morning,

I have a window with a Key event (pbm_keydown) with the following code to call the help:

IF KeyDown(KeyF1!) THEN
    pb_help.TriggerEvent(Clicked!)
END IF

Inside the window I have many objects of all kinds (dw, st, tab, btn,...) and the help does NOT always work when F1 is pressed, and it depends on the object where the focus is.

The objects in the window do not have a coded key event, only the key event of the window itself is coded.

Does anyone have a solution, I want that whenever F1 is pressed it always executes the help code.

Thanks.

 
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 30 November 2021 13:24 PM UTC
  2. PowerBuilder
  3. # 1

Hi Edwardo;

    FWIW: I would design your App to use a menu F1 shortcut. Menu object processing always take precedence. Food for thought 

Regards ... Chris

Comment
There are no comments made yet.
René Ullrich Accepted Answer Pending Moderation
  1. Tuesday, 30 November 2021 12:42 PM UTC
  2. PowerBuilder
  3. # 2

I guess the problem are events with pbm_help event id (e.g. datawindows help event).

https://docs.appeon.com/pb2019/powerscript_reference/ch09s47.html

You could try to use this window event instead of using the key event. If this will not help maybe you also have to forward the help events in the controls to the window.

 

Comment
  1. Eduardo G.
  2. Tuesday, 30 November 2021 12:54 PM UTC
Thanks, but in addition to F1 for help I have coded when F3 and F5 are pressed.
  1. Helpful
There are no comments made yet.
René Ullrich Accepted Answer Pending Moderation
  1. Tuesday, 30 November 2021 12:18 PM UTC
  2. PowerBuilder
  3. # 3

You could add a menu item with F1 shortcut that opens the help file (or triggers an event of the window to do that).

Comment
  1. Miguel Leeuwe
  2. Tuesday, 30 November 2021 14:06 PM UTC
You can still make it work by assigning a menu through code. This is what I do to get shortcuts working by using a menu on response windows.

From the pfc_preopen of my w_master window:



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

if this.windowtype = Response! or this.WindowType = Child! then

If Not IsValid(This.menuId) Then

// Instantiate the menu

if This.ChangeMenu( m_response_retain_shortcut_keys ) = -1 then

return // must be the mdi frame ?

end if

lm = This.menuId

// Hide the menu and it's first level items lm.visible = False

For li_i = 1 To UpperBound(lm.item)

if lm.item[li_i].visible then

lm.item[li_i].visible = False

end if

Next

End if

end if



m_response_retain_shortcut_keys is a menu with all menu items invisible, but not disabled.

regards
  1. Helpful 2
  1. Eduardo G.
  2. Wednesday, 1 December 2021 09:40 AM UTC
Thank you very much, it has been very helpful, this way I have it solved.
  1. Helpful
  1. Miguel Leeuwe
  2. Wednesday, 1 December 2021 10:15 AM UTC
Glad to hear that!
  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.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.