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 :
Finance | Project Operations, Human Resources, ...
Answered

Run code when my TabPage is selected

(0) ShareShare
ReportReport
Posted on by 329
I extended the base form JmgTimecard.FM and added my own TabPage below the Tab RegistrationTab.
 
I was wondering how I could get this done.
 
I've tried the following things:
 
-extend the 'activatePage' function of my tab -> This gives an error that this function is only available for 'fastTabs'
-extend the 'tabChanged' function of the TabPage -> This I wanted to do, but since the Tab is part of the microsoft form and not my extension, I am not allowed to edit the Auto Declaration property.
 
Could someone enlighten me how I could produce this functionality? 
I have the same question (0)
  • Martin Dráb Profile Picture
    237,878 Most Valuable Professional on at
    You shouldn't need Auto Declaration property. What is the code where you need it?
  • Superbunny Profile Picture
    329 on at
    @Martin:
     
    I created a class that contains an extension for my form and tried the following extensions for the formControl:
     
     
    Extending the TAB:
     
    [ExtensionOf(formControlStr(JmgTimecard, TimeTotalsOverview))]
     void activatePage ()
     {
          str testBreakpoint = "testBreakpoint";
     }
     
    Extending the TABPAGE: 
     
     [ExtensionOf(formControlStr(JmgTimecard, RegistrationTab))]
     void tabChanged ()
     {
         str testBreakpoint = "testBreakpoint";
     }
     
    You are indeed correct that the Auto Declaration is not needed at all, when using it within formControlStr, which I just found out.
     
    I however still keep getting the error "This method is only supported on Style=FastTabs.\r\n(S)\\Classes\\FormTabPageControl\\expand\n" on pageload when using either of these extensions.
     
  • Verified answer
    Martin Dráb Profile Picture
    237,878 Most Valuable Professional on at
    The error message talks about neither activatePage() or tabChanged(). It says that the method called in a wrong context is expand(). It seems to be related to some other piece of code; the stack trace will tell you more if you have no idea where it's coming from.
     
    By the way, I'm surprised that you aren't getting compilation errors in tabChanged(), because it has wrong parameters and it lacks the 'next' call. Regarding activatePage(), I don't see it as a method of tab page controls.
  • Superbunny Profile Picture
    329 on at
    ah I see the issue now.
     
    I was extending in the wrong way, that is also why it compiled without the next call.
     
    I added my element extension below another form extension. Because I did not create my own class it did not really get extended.
    I noticed it, when I added next and it said there was no function to extend.
     
    Thanks for the help

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 646 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 529 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 285 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans