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

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

AX 2012: ActiveX field takes focus in form

(0) ShareShare
ReportReport
Posted on by 555

Hi experts!

I have a form with a group holding only one field and that is an ActiveX field of type "Adobe PDF Reader".

In my form I have some lines and every line contains a field with the name of the PDF file that I want to be shown in the ActiveX field when I select a line. So when I go from one line to another, the ActiveX field also changes so it shows the matching PDF file.

It works fine.

In the datasources "Active" method I call my ActiveX control like this: activeX.loadFile('myFile.pdf');

The problem is that the Activex field takes the focus every time loadFile is called. When I click on a line, it shows the correct PDF file, but when I press "arrow down" on the keyboard I don't move to the line below, but the PDF file moves a little inside the ActiveX field. (So if I do that a lot, I can soon see page two of the PDF file.)

How do I keep focus on the line and field, I am in?

Hope you can help...

*This post is locked for comments

I have the same question (0)
  • Morten Steengaard Profile Picture
    555 on at
    RE: AX 2012: ActiveX field takes focus in form

    Of course.

    Thank you very much for helping me!

  • Rustem Galiamov Profile Picture
    8,072 on at
    RE: AX 2012: ActiveX field takes focus in form

    Please, mark question as answered to close the thread.

    If you have another question, you can create the new one.

  • Rustem Galiamov Profile Picture
    8,072 on at
    RE: AX 2012: ActiveX field takes focus in form

    Hmm..I have tested the behaviour that you are described. My form always reset the field...

  • Morten Steengaard Profile Picture
    555 on at
    RE: AX 2012: ActiveX field takes focus in form

    Wow, it works!

    I've done what you wrote, and now the grid and the field works perfectly.

    I have an extra question: If I move to page two in the pdf file, and then go one line up in my grid, then the other pdf file is also showing page two. The same goes for zooming etc.

    Is there a way to reset the field, so it forgets that the user wanted to see page two? (So that when I show a new pdf file, it always shows page one.)

  • Verified answer
    Rustem Galiamov Profile Picture
    8,072 on at
    RE: AX 2012: ActiveX field takes focus in form

    So, in the active() method put ActiveX.enabled(false); before ActiveX.loadFile().

    Then override mouseDown() method on the GroupPictureGroup methods and set ActiveX.enabled(true);

    Screenshot-2019_2D00_08_2D00_21-at-14.01.12.png 

    Screenshot-2019_2D00_08_2D00_21-at-14.01.06.png

  • Morten Steengaard Profile Picture
    555 on at
    RE: AX 2012: ActiveX field takes focus in form

    I have copied my form and removed everything else from the form. So now it only has one grid (with one column) and one ActiveX-field.

  • Morten Steengaard Profile Picture
    555 on at
    RE: AX 2012: ActiveX field takes focus in form

    Hope this helps:

    pastedimage1566377263647v1.jpeg8741.jpg2821.jpg

  • Rustem Galiamov Profile Picture
    8,072 on at
    RE: AX 2012: ActiveX field takes focus in form

    Could you share some screenshots of form design, activeX control properties and active() method code, please?

  • Morten Steengaard Profile Picture
    555 on at
    RE: AX 2012: ActiveX field takes focus in form

    I still don't know which column (field) I am on. If I in the "Active" method calls "element.selectedControl().name()" it always returns the name of the grid and not the grid + the field like "myGrid_myField".

    AutoDeclaration is YES on every field in the grid, and I have tried calling setFocus() on the first field in the grid, but that doesn't change anything. The ActiveX field still steals my "arrow down" keystroke.

  • Suggested answer
    Rustem Galiamov Profile Picture
    8,072 on at
    RE: AX 2012: ActiveX field takes focus in form

    Just set AutoDeclaration property's value to YES on the field on the grid and then call setFocus(). The row will be the same, this method doesn't affect the row position.

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…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Syed Haris Shah Profile Picture

Syed Haris Shah 9

#2
Community Member Profile Picture

Community Member 2

#2
Mea_ Profile Picture

Mea_ 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans