How to remove accelerator keys from displaying in label

Posted by nix1016 on 18-Aug-2015 21:29

When creating a dynamic menu-item and assigning an accelerator to the item, it seems that the menu would show the accelerator keys as a part of the label.

e.g.

create menu-item v_Handle assign
parent = p_Parent
label = 'Menu'
accelerator = 'Ctrl-M'

The menu would show "MenuCtrl+M". Is there a way to remove the Ctrl+M from the label?

All Replies

Posted by James Palmer on 19-Aug-2015 00:54

Never come across this but does it make a difference if you assign the accelerator key first then the label?

James Palmer | Application Developer
Tel: 01253 785103

[collapse] From: nix1016
Sent: ‎19/‎08/‎2015 03:30
To: TU.OE.Development@community.progress.com
Subject: [Technical Users - OE Development] How to remove accelerator keys from displaying in label

Thread created by nix1016

When creating a dynamic menu-item and assigning an accelerator to the item, it seems that the menu would show the accelerator keys as a part of the label.

e.g.

create menu-item v_Handle assign
parent = p_Parent
label = 'Menu'
accelerator = 'Ctrl-M'

The menu would show "MenuCtrl+M". Is there a way to remove the Ctrl+M from the label?

Stop receiving emails on this subject.

Flag this post as spam/abuse.




This email has been scanned for email related threats and delivered safely by Mimecast.
For more information please visit http://www.mimecast.com
[/collapse]

Posted by nix1016 on 19-Aug-2015 02:35

Yep, have tried this to no avail.

I can fix it by commenting out the accelerator = 'Ctrl-M' part but then it would lose the shortcut as well

Posted by nborshukov on 19-Aug-2015 03:45

What you try to achieve? You want to have accelerator but not to be visible?

Also provide OE and OS info, please!

Posted by nix1016 on 19-Aug-2015 21:53

Currently the accelerator appears as a part of the menu label for some reason, e.g. if the menu name is called 'Customers' and I have Ctrl+C as the accelerator, it's showing up as 'CustomerCtrl+C'.

I want it to hide the accelerator from the label but still be able to use the accelerator shortcut. I'm using OE10.1B and Windows 8.1.

Thanks!

Posted by nborshukov on 20-Aug-2015 03:06

And what about static menu item with accelerator? Does it looks the same way?

And one more question - do you create dynamic menu items once per window lifetime(on window initialization), or they are recreated depending on some user actions?

Posted by nix1016 on 20-Aug-2015 21:44

A dumb question, but how do I define an accelerator key for a static main menu? It seems to be greyed out but is available for static sub menus:

As for the sub menus, they do show the accelerator keys but that's fine because there is more space to show them, but I just don't want them to appear on the main menus.

And yes we only need to define them once upon loading but the menus are positioned/labelled differently based on different parameters so we can't define them using static menus unfortunately.

Posted by TheMadDBA on 20-Aug-2015 22:08

What you are calling the sub menu is actually the menu item. Accelerator keys are for menu items and not for menus/sub menus.

If you had something like this

File -> New ->  Word Doc

File -> New -> Excel

You can add accelerators for Word Doc and Excel but not for File or New.

Posted by nborshukov on 20-Aug-2015 23:39

In your example,you can define accelerators for Exit, Cut, Copy and Paste menu items using Key... button.

if you create dynamic menu items once upon loading, you can define anywhere triggers for the containing window for accelerator keyboard events next way:

create menu-item v_Handle 
    assign
        parent = p_Parent
        label = 'Customer'
        /* accelerator = "Ctrl-C" */
    triggers:
        on 'choose':U 
            persistent run customer-proc in this-procedure. 
    end triggers.               

    on 'Ctrl-C' of {&window-name} anywhere
        persistent run customer-proc in this-procedure. 


Posted by nix1016 on 21-Aug-2015 01:21

Thanks for that! The only thing is that the accelerator is actually a variable that changes based on a parameter (users can set their own accelerators).

So how do I call something like

v-shortcut = 'Ctrl-C'.
on v-shortcut of {&window-name} anywhere
        persistent run customer-proc in this-procedure.

using accepted syntax?

Posted by nborshukov on 21-Aug-2015 02:45

AFAIK you can't.

I give up for now.

But I'm still interested what about static menu item accelerators?

This thread is closed