im working on delphi 7, and i have an applicaton where im using a action manager for creating actions and then assigning them shortcuts the shortcuts in action manager are already defined in the shortcut property..but i want to have a shortcut like
1. ADD ,that is the + on the numpad
2. Subtract key ,that is the - on the numpad
3. divide key , that is the / on the numpad.
4. enter key
i tried assigning my own shortcut as subtract and ADD but it gives me this error message
i also tried - but nothing is happening
my code to track the action
var
Action : TBasicAction;
begin
Action := Sender as TBasicAction;
if (Action is TAction) and not TAction(Action).Enabled then exit;
case Action.tag of
1 : ShowMessage('ADD + pressed');
2 : ShowMessage ('divide / pressed');
3 : ShowMessage ('subtract - pressed');
4 : ShowMessage ('enter pressed');
end;
end;
i can use the normal
**GetKeyState(VK_ADD) AND 128)=128;** OR **GetKeyState(VK_return) AND 128)=128;**
to find it the keys are pressed in keypress or keydown event but i want to use the action manager shortcuts
You can assign them at runtime:
Action1.ShortCut := menus.ShortCut(VK_ADD, []);
Action2.ShortCut := menus.ShortCut(VK_SUBTRACT, []);