Test if Dialog is open?

Mike_HWGMike_HWG Member Posts: 104
When you call Dialog.CLOSE, you run the risk of a runtime error that results in the message, "The dialog window is not open".

Is there a member function for Dialog to test for this, or do you just use a variable?
Michael Hollinger
Systems Analyst
NAV 2009 R2 (6.00.34463)

Comments

  • jspoppjspopp Member Posts: 54
    Hi, Maybe try something like:

    IF Dialog.OPEN(...) THEN
    Dialog.CLOSE();
  • Mike_HWGMike_HWG Member Posts: 104
    :lol: I'm guessing you were a Windows API programmer?


    Unfortunately, the OPEN and CLOSE functions don't have a return type in NAV ](*,)
    Michael Hollinger
    Systems Analyst
    NAV 2009 R2 (6.00.34463)
  • jspoppjspopp Member Posts: 54
    Oh, you are right,. I was thinking of File.OPEN().
  • kinekine Member Posts: 12,562
    In common process, you know if you have opened the dialog or not and if you need to close it or not. If you do not know this, than the problems is somewhere else. You can find out, that you even do not need to close the dialog, because it will be closed after the variable is out of scope. Biggest issue which could lead to something you are trying to solve (I guess) is, when the dialog is global variable in codeunit/record/something else, what is called and is used through global variable in the form. Than the variable is still in the scope even when error was called and the dialog is not closed...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
Sign In or Register to comment.