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)

using controlMethodOverload() to overload formRun.closed()

(0) ShareShare
ReportReport
Posted on by

Hi there

I try to capture a close command from a form outside the form itself. So I created a class and put code like this:

class foo

{

FormRun fr;

void bindForm(FormRun _formRun)

{

           fr = formRun;

           formRun.controlMethodOverload(true);

           formRun.controlMethodOverloadObject(this);

}

void formRun_close()

{

   /* ...

       do some extra code

   */

   fr.close();

}

}

However, the formRun_close method is never called, how do I have to name the method correctly?

formRun_close? (obviously not ...)

form_close?

this_close?

???_close?

Thank you for your Ideas

*This post is locked for comments

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

    Normally the name of the object gets used here. Does the formRun have a name? Try to put that to infolog and then use it [Name]_close

  • Community Member Profile Picture
    on at

    Well, in my test case, the formRun.name() is "Form1" but with Form1_close this works neither ... :(

    Other Ideas?

  • Martin Dráb Profile Picture
    237,878 Most Valuable Professional on at

    I wouldn't be surprised if it's not possible - form is not a form control, after all.
    If you can change the form, just create a callback method in your class, pass the instance to the form and invoke the callback in close(). You'll get normal object-oriented code which doesn't depend on any special naming or such things.

  • Verified answer
    Joris dG Profile Picture
    17,775 on at

    Hmmm, I think control method overload only work for control methods, not the form itself. At least I've never tried it, but it would open a lot of interesting opportunities if that actually worked.

  • Martin Dráb Profile Picture
    237,878 Most Valuable Professional on at

    Just to extend my answer - if you're in AX2012, you could also expose an event in SysSetupFormRun and simply subscribe to it in your class.

  • Community Member Profile Picture
    on at

    Thank you for your answers and Tipps. Unfortunately with this issue I'm working in AX 2009 ...

    But it really seems, that control overload method only overloads control's events (as the name suggests) and not the formRun element itself ...

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
Priya_K Profile Picture

Priya_K 4

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#3
Ali Zaidi Profile Picture

Ali Zaidi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans