Can we Call Button Click event by Enter Key in key Board.


I have a button in my customized form. i want to call this Button Click() method by Enter key in key board when my form is active.

Can we do this in Axapta 2012. Can you please guide me.

Thanks in advance,


You can override form’s task() method and call some code if _taskId == #taskEnter (#taskEnter is defined in Task macro library in AOT).

Hope this site would be helpful to you -

For enter keyboard : task id is 288

Hi, The user performs some task in a form by using the toolbar, the menu, or the keyboard.

For Example Here I am Closing the Form by pressing TAB Steps:

  1. Create a Form Ex: Test Form

  2. In Design node Take string Edit Control.

  3. Create Task() method in Form Methods.

  4. Set the Debug Mode on Task() method. Using this debug you can find Keyboard ID (like here we are doing through TAB)

5.Then Press F5.

6.Enter some text in String Edit control.

7.It will take to you on Debug Mode.Here (ret = super(_taskId):wink: you will get the Task ID. 8.

for example … public int task(int _taskId) { int ret; ret = super(_taskId);// task Id will get keys ID value if(_taskId == 2827)//2827 is the TAB ID element.close(); return ret; }

Thank you every one for your reply. I got it.