Bug 6498

Ribbonbar Issue - Incorrect handle being passed when Shortcut key is duplicated across Categories 10 May, 2021

Christopher Craft
28 April, 2021
Product: PowerBuilder Category: Controls & UI
Version: 2019 R3 Build: 2670
Classification: Enhancement Publishing: Public
Priority: P2
Status: Transferring Reason:
Mark Lee @Appeon 07 May, 2021
Hi Chris,

OK. I see. You mean the menu on each sheet itself. When a sheet window is inactive, its menu is removed from the frame, so it wouldn't have such an issue.
Anyway, we've transferred this as an enhancement request to our product team to consider in a future release.

Mark Lee
Christopher Craft 06 May, 2021
Then your menu item is on the Frame - it will not fire if it exists on a menu in an inactive Sheet.  If you are saying it does can you upload your test?
Mark Lee @Appeon 06 May, 2021
Hi Chris,

Thanks for reporting this problem.
We will record it as a new requirement/enhancement request and will transfer it to our product team for consideration.
BTW, based on our test, the traditional menu's shortcut has the same behavior.

Mark Lee
Christopher Craft 05 May, 2021
Thank you Chris.  And to make more of a case for my request - if you are running a browser and do Ctrl + S it will fire against the active tab page not the first tab page! :-)
Chris Pollach @Appeon 05 May, 2021
Hi Chris;

  Thank you for the clarification.

  Sounds like from what you are describing that you would like to submit this as an enhancement request. I will therefor transfer this ticket over to the main Support / Engineering team for their review and feedback on this aspect.

Regards ... Chris
Christopher Craft 05 May, 2021
Don't think I am following you - Shortcuts do not work on inactive sheets.  In a menu object each sheet that opens has its own menu so if Program A and Program B are both open when you do the shortcut it will ONLY fire against the active sheet and the Frame.  Since I am mimicking this behavior for the ribbon bar (each sheet that opens gets its own category tab) I need the shortcut to fire against the active category first. This would be a more consistent behavior with the menu object.

I did implement code to determine if the action being called is valid for the active window but my problem is I have multiple actions that have the same shortcut key that do different things depending on the window it is applied to.  This works fine in traditional menu but now the ribbon will always find the shortcut from the first button loaded. Example: Program A has an action called 'Void' which has the shortcut Ctrl+1. Program B has an action called 'Process' which has the same shortcut.  The ribbon will now only ever send the handle from the Void action which is not valid for Program B. I can't write code to support this scenario. I also can't change my shortcuts because 1) My users have been using them for years and 2) I have to support running my app using the traditional menu or the new ribbon.

Like I said, I understand that the shortcut still needs to fire across all the categories but I am asking that it first fire on the active one.  If it does then I can write the code to support an action that doesn't exist on the active sheet but I can't do it the other way. This change should have zero impact because if the logic was that shortcut keys should not be duplicated across tabs then that would still work.

I hope this makes sense.

Chris Craft
Chris Pollach @Appeon 05 May, 2021
Hi Chris;

  Thank you for the test case example! 

  Like a Menu Object though that has a menu item assigned to the CTRL+1 short-cut, it would always fire the menu items "clicked" event no matter where the App user was when a CTRL+1 is entered. That seems like consistent behaviour here in the TB as well.

  Would it not then be up to you to code the CTRL+1 save logic to first perform a GetFocus() first to find out if you want to bypass a Save action depending on where the app user is interacting within the PB App?

Regards ... Chris
Christopher Craft 04 May, 2021
ShortcutIssue.zip (13KB)

I have attached an example.  I assigned a shortcut key of 'Ctrl+1' to Save in the File category as well as to Vertical in the Window category.  No matter what category has focus you will always get the Save action firing when using the shortcut. I need the logic to first look at the active category.
Chris Pollach @Appeon 28 April, 2021
Hi Chris;

   Would you happen to have a simple Test Case that portraits this issue?

Regards ... Chris
Christopher Craft 28 April, 2021
My application will create a category tab for every window that opens (like a browser). All of my original toolbar items like Save, Delete, etc. will populate as buttons on the ribbon panel. These buttons have a shortcut key assigned.  When you have multiple programs opened (ie. multiple categories) and you use a shortcut key to execute the action it will only pass the button handle from the first category and not the button handle from the active category.

I can understand that a shortcut key needs to look across all the objects but it should search in the Active Category first. If it doesn't find it there then search all.
Windows 10
Database Type:
Database Version: