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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

How to set first field on form load

(0) ShareShare
ReportReport
Posted on by 195

Hi there,

I would like the cursor to start in the ItemId field of the first sales line when I open up the SalesTable form. In firstField(), I have this:

public void firstField(int _flags=1)

{

   super(_flags);

   this.nextGroup();

}

My nextGroup() method looks like this:

void  nextGroup()

{

   info('In nextGroup()');

   if (!SalesLine::exist(salesTable.SalesId))

   {

       salesLine_ds.create();

   }

   salesLine_ItemId.setFocus();

}

When I open up the SalesTable form, I get the info message, then the cursor goes to the ItemId field, BUT THEN, the cursor goes to a field in the header.

How do I find out what is moving the cursor up there?

Thanks,

Tom

*This post is locked for comments

I have the same question (0)
  • Verified answer
    KLSI Profile Picture
    40 on at

    Hi,

    there are several reason for a changed focus in a form...

    However, to solve you issue, I would set the focus directly to the salesLine_ItemId control like this is done in salesLine_ds.create() (at least in AX 2012 R2 CU7). You could call salesLine_ItemId.setFocus() in SalesTable_ds.active() or linkActive(), depending on what you want to achive...

    Best regards

    Simon

  • tomhv Profile Picture
    195 on at

    Thanks, Simon!  I fixed this by using the linkActive() method on the SalesLine data source.

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

News and Announcements

Season of Giving Solutions is Here!

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
TAHER Mehdi Profile Picture

TAHER Mehdi 3

#2
Martin Dráb Profile Picture

Martin Dráb 2 Most Valuable Professional

#2
Nakul Profile Picture

Nakul 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans