Form Focus Question

lloydsmodslloydsmods Member Posts: 93
My client has a modified customer card which has tabs with custom subforms. To prevent the focus from automatically being placed in the subforms OnOpenform, they added code to force the form to ACVTIVATE the "No." field on the General tab. They want the form to work like other forms where NAV remembers where the cursor was focused when you last viewed the card.

They have this code in the OnOpenform trigger:
CurrForm.Contact.EDITABLE("Primary Contact No." = '');

CompanyInfo.GET;
IF CompanyInfo."Use External BIDS" THEN BEGIN
  CurrForm."Customer Contact Information".VISIBLE(FALSE);
  CurrForm.ContactList.VISIBLE(TRUE);
END;

CurrForm.Name.ACTIVATE;

IF COMPANYNAME = '...' THEN BEGIN
  CurrForm.Region.VISIBLE := TRUE;
  CurrForm."Freight is Taxable".VISIBLE := TRUE;
END;

IF CompanyInfo."Use External BIDS" THEN BEGIN
  CurrForm."Customer Contact Information".ENABLED(TRUE);
  CurrForm.ContactList.ENABLED(TRUE);
END;

MemberOf.SETRANGE(MemberOf."User ID",USERID);
MemberOf.SETRANGE(MemberOf."Role ID",'NTL CUST, EDIT');
IF MemberOf.FINDFIRST THEN
  CurrForm.NTLCustCode.ENABLED(TRUE);

They also have this code in the OnAfterGetRecord trigger:
SETRANGE("No.");
CurrForm.Name.ACTIVATE;

Commenting out the ACTIVATE lines doesn't change the form's behavior.

Any suggestions would be helpful.
If guns cause crime mine must be defective.

Comments

  • kinekine Member Posts: 12,562
    You do not need that... Jut set the delayed insert on the subform to true and you are done...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • rhpntrhpnt Member Posts: 688
    lloydsmods wrote:
    My client has a modified customer card which has tabs with custom subforms. To prevent the focus from automatically being placed in the subforms OnOpenform, they added code to force the form to ACVTIVATE the "No." field on the General tab. They want the form to work like other forms where NAV remembers where the cursor was focused when you last viewed the card.

    If "they" want the default NAV behaviour then "they" should also switch back to the default form. Meaning moving ALL subforms from tabs to separate forms called by menu buttons, deleting all code "modifications" and rearranging the form controlls acording to NAV standards.
  • lloydsmodslloydsmods Member Posts: 93
    That's what I advised "them" had to be done, so "they" dropped the project. Thanks for your "input".

    I figured they were stuck, but I thought I would see if anyone knew a workaround.
    If guns cause crime mine must be defective.
Sign In or Register to comment.