Highlighted
Outstanding Contributor.
Outstanding Contributor.
3455 views

Function key to call a menu option

Jump to solution

Hello, 

How do I place a function key to call a menu option?
And how does the show in menu?
Thanks
Alberto Ferraz
0 Likes
2 Solutions

Accepted Solutions
Highlighted
Outstanding Contributor.
Outstanding Contributor.

RE: Function key to call a menu option

Jump to solution

Hi,

I have researched a lot by Google but still could not find the solution and so resorted here to the forum.

I have also researched the link you sent me but I found the solution.

I will continue to look to see if I have better luck.

Thanks

Best regards

Alberto Ferraz

View solution in original post

0 Likes
Highlighted
Outstanding Contributor.
Outstanding Contributor.

RE: Function key to call a menu option

Jump to solution

Hello,

Sometimes we complicate what can be simplified.

I solved the problem by creating the "Menu_KeyDown" event and i detect the function keys and depending on each call a menu option.

Thanks.

View solution in original post

0 Likes
10 Replies
Highlighted
Outstanding Contributor.
Outstanding Contributor.

RE: Function key to call a menu option

Jump to solution

 Hi

I've got the function keys appear on the menu options.

Now how do you use them?

Best Regards

Alberto Ferraz

,

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: Function key to call a menu option

Jump to solution

I would highly recommend that for questions like this, how to use a .NET class or WPF functionality that you Google your question to other sources than this forum. The reason is that .NET is a Microsoft technology and there are many examples of how to use the various classes on other web sites and within the MSDN documentation.

For example, the link here explains how to handle a Menu control in WPF and provides examples in C#. These examples normally translate directly into COBOL but if you require help with the translation you can post your questions here.

Thanks

0 Likes
Highlighted
Outstanding Contributor.
Outstanding Contributor.

RE: Function key to call a menu option

Jump to solution

Hi,

I have researched a lot by Google but still could not find the solution and so resorted here to the forum.

I have also researched the link you sent me but I found the solution.

I will continue to look to see if I have better luck.

Thanks

Best regards

Alberto Ferraz

View solution in original post

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: Function key to call a menu option

Jump to solution

Ferraz, I created a quick sample in WinForms and by simply specifying the short-cut keys in the Collection they were enabled. There was no special code necessary to enable them. I first tried the sample with a mouse click and then I pressed "Ctrl + 1" which was the short-cut and it worked.

How did you specify your short-cut keys?

0 Likes
Highlighted
Outstanding Contributor.
Outstanding Contributor.

RE: Function key to call a menu option

Jump to solution

Hi Rick,

I want de Function Key (F1/F2/F3/...) like i have in picture. 

Interest is to use the function keys to directly call the menu options.

Thanks

Alberto Ferraz

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: Function key to call a menu option

Jump to solution

Alberto, my sample is using WinForms and the properties for the menus enable this. If you're not using WinForms there may be some differences.

0 Likes
Highlighted
Outstanding Contributor.
Outstanding Contributor.

RE: Function key to call a menu option

Jump to solution

Hi,

I am using WPF so I do not know if your solution will be compatible.

Anyway if I want to send can check and test.

Thanks

Alberto Ferraz

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: Function key to call a menu option

Jump to solution

I have done some research on this and have found in the link that I provided to you a section on using Commands in WPF and binding them to controls like menu items and buttons, etc.

In particular the one that I found useful was to define all of your command as type RoutedUICommand within a static class and then bind your menu items to these commands within XAML.

By attaching the CanExecute and Executed events to each command you can have it automatically invoke a specified method whenever the command is executed. Commands can be executed by selecting the control such as a menu item or by pressing a key which you have defined as an InputGesture for the command.

There was some syntax in the C# example for RoutedUICommands that involved initializing a collection directly within the constructor of the field that was not directly supported in the current version of Visual COBOL so I devised a workaround of creating a property for each of the commands.

I have attached an example to this post. The example defines the commands used in a static class and then references them both as menu items and as buttons. You could also use the same commands in a context menu.

Let me know if you have any questions:

Thanks.

0 Likes
Highlighted
Outstanding Contributor.
Outstanding Contributor.

RE: Function key to call a menu option

Jump to solution

I Chris.

I've been to see the example that sent me, and I confess I have not been able to understand well.

Tomorrow I will review it again to see if I can understand.

Then I give the feed-back.

Thanks for your time.

Best Regards

Alberto Ferraz

0 Likes
Highlighted
Outstanding Contributor.
Outstanding Contributor.

RE: Function key to call a menu option

Jump to solution

Hello,

Sometimes we complicate what can be simplified.

I solved the problem by creating the "Menu_KeyDown" event and i detect the function keys and depending on each call a menu option.

Thanks.

View solution in original post

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.