web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Event for form lost focus

(0) ShareShare
ReportReport
Posted on by 160
Hi All,
I have doubt regarding AX 2009 form events.
Do we have an event to Notify us the form is LostFocused.
Which method will be triggered when the form is LostFocused?
Appreciate a response.
Regards,
Srinath. S

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at

    Hi Srinath, Go to Infolog.formNotify There you have notifications for several form event like activate, Open, Close etc. You can add a code like the one shown below to work during deactivation of a form. But keep in your mind this will affect the overall performance as this will be invoked several times.

    case FormNotify::DeActivate:

    if (formRun.form().name() == "CustTable")

    { Info('form not active');

    }

    break;

  • srinath Profile Picture
    160 on at

    Hi,

    If i write code in the case FormNotify::DeActivate: then the code is not getting called when i move from one AX form to other form.

    Appreciate a response. 

     Even sometimes in the form activate method if you have written code then few cases it will show "source code not available" when debugging. Can i know the reason for this.

    Regards,

    Srinath. S

  • Community Member Profile Picture
    on at

    Hi All,

     As i customized the info class  formnotify() to meet the requirement, export the customized objects along info class as xpo and imported the same in new environment.

    After the import the AX throws infolog message saying the Error: Recompile the script Info\formnotify(). I need to follow the below steps after importing then only the issue is getting resolved.

     1. Recompile or do compile forward for 3 or 4 times

    2. Relauch ax and compile.

     Is this issue will happen when we write code in info class?

    How to rectify the issue instead of compiling. Because will feel something happened wrong. Instead of making the Infologdetail as none in the Tools-> options window anyother way to do automatic compiling and not showing the infolog error message.

    Please suggest me on this.

    Appreciate a response.

    Regards,

    Srinath. S

     

  • Suggested answer
    Community Member Profile Picture
    on at

    Hello srinath,

    after 7 years, this may not help you directly. Perhaps, however, the rest of the Community may need help with this at one point or another.

    1.:  Add this Method to the Info Class:

    public void OnLoseFocus()

    {

       FormRun  frLastActivatedForm = lastActivatedForm ? lastActivatedForm.object() : null;

       Object      foLastActivatedForm = frLastActivatedForm;

       ;

       if (frLastActivatedForm && formHasMethod(frLastActivatedForm, identifierstr(OnLoseFocus)))

       {

           foLastActivatedForm.OnLoseFocus();

       }

    }

    2.:  Adjust the Method setLastActivatedForm on the Info Class by adding this Line at the beginning of the Method.

       this.OnLoseFocus();

    3.:  In the Form of your choice, add a public Method OnLoseFocus and apply your code here.

    Hope this helps.

    Jonathan Watkins

  • Pravasti AK Profile Picture
    2,985 on at

    Hi,

    Please refer the below link:

    https://msdn.microsoft.com/en-us/library/aa628445.aspx

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans