Page.RUNMODAL = Action::OK in 2013 R2

majormarcell1988
majormarcell1988 Posts: 20
edited 2014-02-27 in NAV Three Tier
Hi there,

I have a following problem:

CustLedgEntry.SETRANGE("Customer No.","Bill-to Customer No.");
CustLedgEntry.SETRANGE("Currency Code","Currency Code");
CustLedgEntryPage.SETTABLEVIEW(CustLedgEntry);
CustLedgEntryPage.SETRECORD(CustLedgEntry);
IF (CustLedgEntryPage.RUNMODAL = ACTION::OK) THEN
BEGIN
...
END;

When the page runs and i click the OK button everything works as i want, but when i just simply close the page the CustLedgEntryPage.RUNMODAL = ACTION::OK returns true as well and the code will run again.

Is there any way to separate them ?

Thanks in advance.

Comments

  • Hi there,

    I have a following problem:

    CustLedgEntry.SETRANGE("Customer No.","Bill-to Customer No.");
    CustLedgEntry.SETRANGE("Currency Code","Currency Code");
    CustLedgEntryPage.SETTABLEVIEW(CustLedgEntry);
    CustLedgEntryPage.SETRECORD(CustLedgEntry);
    IF (CustLedgEntryPage.RUNMODAL = ACTION::OK) THEN
    BEGIN
    ...
    END;

    When the page runs and i click the OK button everything works as i want, but when i just simply close the page the CustLedgEntryPage.RUNMODAL = ACTION::OK returns true as well and the code will run again.

    Is there any way to separate them ?

    Thanks in advance.


    Confirmed, it's a bug.

    Tested on build 35796.

    Matteo
    Reno Sistemi Navision Developer
  • Thanks for you info, i tested it on Build 35664 and 35473.
  • Duikmeester
    Duikmeester Posts: 309
    Dont know the use for ACTION::OK but thru-out the code ACTION::LookupOK is always used.

    Edit: I did an export of the full source and noticed some spots that seem to be using ACTION::OK..., so yes it seems broken also with 35800.
  • In Microsoft Dynamics NAV help you can read in RUNMODAL command help:

    Page.RUNMODAL Return Values:
    OK Chooses the OK button.
    Chooses the X button when there was no Cancel button on the window.
    Presses the Esc key when there is no Cancel button on the window.

    Cancel Chooses the Cancel button.
    Chooses the X button when there is a Cancel button on the window.
    Presses the Esc key when there is a Cancel button on the window.

    LookupOK Chooses the OK button.
    Chooses an item in the Lookup window.
    To close a lookup window, the user chooses the OK button.

    2013 version return values are differente from 2009 version
    You get OK also if you close the page with Esc key (and this is crazy......)...
  • 181deepak
    181deepak Posts: 95
    Hi there,



    CustLedgEntry.SETRANGE("Customer No.","Bill-to Customer No.");
    CustLedgEntry.SETRANGE("Currency Code","Currency Code");
    CustLedgEntryPage.SETTABLEVIEW(CustLedgEntry);
    CustLedgEntryPage.SETRECORD(CustLedgEntry);
    IF (CustLedgEntryPage.RUNMODAL = ACTION::OK) THEN
    BEGIN
    ...
    END;
    CustLedgEntry.SETRANGE("Customer No.","Bill-to Customer No.");
    CustLedgEntry.SETRANGE("Currency Code","Currency Code");
    IF PAGE.RUNMODAL(CustLedgEntryPage,CustLedgEntry) = action::lookupok then begin
    end;

    try this...
  • allenyyzhou
    allenyyzhou Posts: 142
    I faced the same problem here(NAV 2013 R2). How should I fix this? I need to know if user clicked the X button or ESC, if they do so, I am suppose to do nothing.
  • This is not a bug. There is nothing to fix.
    They just changed RUNMODAL command behavior.
    Read RUNMODAL command description in Dynamics Nav Help.
  • wertis
    wertis Posts: 3
    This is logical and conceptual bug.
    How I hate this stupid new navision.