Nav 5.0 dialog bug?

NagiNagi Member Posts: 151
Hi,

Is there a bug in Nav 5.0 that causes the entire program to exit when a user enters ESC in a dialog popup?

I have a variable PopUp of type Dialog that prompts the user to enter an organization no. (custom field) on the customer, if the customer doesn't have one entered already. Nav terminates if the user hits ESC.

I have tried handling a possible return of zero in my code, but the effect is still the same. Am I doing something wrong or is this a bug in Nav 5.0?

In advance, thanks for any feedback.
IF "Organization No." = '' THEN BEGIN
  PopUp.OPEN(STRSUBSTNO(Text101,FIELDCAPTION("Organization No."),"No.") + '\' +
             '#1#######################');
  IF PopUp.INPUT(1,OrgNo) = 0 THEN
    EXIT;
  PopUp.CLOSE;
  VALIDATE("Organization No.",OrgNo);
END;

Cheers!

Comments

  • ara3nara3n Member Posts: 9,256
    Navision terminates if you hit ESC. That's how it works in 4.0 and 5.0.
    Ask them to just hit ENTER if they don't want to enter anything.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • NagiNagi Member Posts: 151
    So then it's a bug. In the C/SIDE reference guide it says that when "the user presses ESC to leave the window, the window will close and the calling C/AL code will terminate, and zero is returned." Weird though, that this fault has survived from 4.0 all the way up to 5.0, when it should be quite easy to spot.

    Cheers, and thanks for your reply! =D>
  • ara3nara3n Member Posts: 9,256
    I'd call it a feature. :mrgreen:
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • kinekine Member Posts: 12,562
    I heard weird things about Dialog input that I never used this possibility. I am using some special form or report to get the data from user.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Hi Nagi

    When you press ESC in a dialog it should return zero - not terminate.
    You wrote that the entire program exits when you press Esc in a dialog - but I am not able to reproduce that. Can you give me more context?

    Regards

    Michael
    This posting is provided "AS IS" with no warranties, and confers no rights.
  • ara3nara3n Member Posts: 9,256
    Here is an example.
    PopUp.OPEN('Please Enter value #1#######################');
    if PopUp.INPUT(1,value) = 0 then
    PopUp.CLOSE;
    message(value);
    
    If you htt ESC. the message will not execute.

    I looked at documentation and it states that it will terminate.
    If the user presses Esc to leave the window, the window will close and the calling C/AL code will terminate, and zero is returned.

    So looks like it's working as suppose to.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • I just looked in the source code and you are right. But it is a bug (even though it is documentet). The C/AL Dialog subsystem checks for Esc and should return zero - but the underlying formsubsystem terminates for some reason.

    I am still interested in the example where it closes the whole client?
    This posting is provided "AS IS" with no warranties, and confers no rights.
  • NagiNagi Member Posts: 151
    Hi Michael,

    The full scenario is like this:

    I have a function called PromptOrgNo with the code mentioned in the initial post. PopUp is a variable type dialog. Text101 reads 'Define %1 for customer %2'. OrgNo is a local variable type text 20. Organization No. is a custom field type text 20. The function is called in the OnValidate trigger of the Name field in the customer table.

    The popup window asks the user to enter an organization no. for the customer after the name is validated, and if user hits ESC instead of pressing cancel it will terminate NAV.
  • NavStudentNavStudent Member Posts: 399
    offtopic, that's realy bad way to program.
    You don't want to ask for something in the middle of a transaction.

    In regards to crashing the finsql.exe 5.0 crashes when you hibernate the computer. It doesn't do it in 4.0
    my 2 cents
  • Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    "Michael wrote:
    "]I just looked in the source code and you are right.
    You have one advantage compared to us NAV developers: you can look in the source code of fin.exe ;-)

    Thank you for your participation in this forum. Good to see Navision employee No. 5 is still active with NAV ... and has found the way to communities.
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • gedasgedas Member Posts: 87
    Hi guys

    I can't reproduce, or I'm looking in wrong direction.

    ...
    PopUp.OPEN('Please Enter value #1#######################');
    if PopUp.INPUT(1,value) = 0 then
    PopUp.CLOSE;
    message(value);
    ...

    1.Message never comes up - Esc or Cancel I push.
    2.Nav never closes - there are no differencies between Cancel or Esc
    GB
  • kinekine Member Posts: 12,562
    Hello Gedas,

    may be that difference is that you are trying it from table C/AL code and Nagi from Form C/Al code? But it is just a "may be"...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • I am not able to reproduce the Dialog.INPUT crash - but as NavStudent points out finsql.exe crashed when you hibernate the computer. This bug was fixed in 4.0 SP1 - but apparently it is back in 5.0 and will be fixed for SP1
    This posting is provided "AS IS" with no warranties, and confers no rights.
Sign In or Register to comment.