2012年7月5日星期四

How to handling Key strokes in AX

The task method in a form will serve the purpose the handling keystroke events to some extent.
Though we cannot catch all the keystrokes, we can handle a few of them:

For example,
 
public int task(int _taskId)
{
    int ret;
    #task
    ;
    if (_taskId == #taskesc)
    {
        Box::okCancel("I am not going to listen to you and u can’t close me with a silly Escape button", DialogButton::Ok);
    }
    else
    {
        ret = super(_taskId);
    }
    return ret;

}

All the tasks defined in the task macro can be handled. Apart from those, other events are:
F1, Ctrl + N, Ctrl + C, Ctrl +v, etc … just put the following line in the task method to get these values:

Info (int2str (_taskId));

没有评论:

发表评论