Overide Global Function?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • thetford
    Forum Member
    • Feb 2005
    • 175

    Overide Global Function?

    ok, this is a great function to prevent people from closing the app, but what do I do when I need to close the app without the users input i.e. not showing the dialog confirmation?

    Code:
    --This code asks user to "BE sure that they want to exit"
    function QueryAllowProjectClose()  --this function will be called when the program is exiting
        if close_value
        then Application.Exit(0);
        else
        confirmation = Dialog.Message("NOTICE", "WARNING! \r\ If you close this license manager you will not be able to run Credit Mechanic software.\r\Are you sure you want to Exit?", MB_YESNO, MB_ICONEXCLAMATION, MB_DEFBUTTON1);
        if confirmation == 6 then
       -- The yes button was pressed, allow program to close (return true)
           return true;
       
       else
           -- The yes button was NOT pressed, do NOT allow the program to close (Return false)
            return false;
        end
    end
    end
    I just keep running into problems this weekend!
    thanks in advance.
  • longedge
    Indigo Rose Customer
    • Aug 2003
    • 2498

    #2
    You don't need to do anything at all really, at an appropriate point in your code use -

    Application.Exit();

    That doesn't call for any user interevention.

    Comment

    • thetford
      Forum Member
      • Feb 2005
      • 175

      #3
      Well, the code is in the "Global Function" area. So whenever the application closes, it displays the dialog.

      Yes, i have tried the Application.Exit();

      take a look a the sample project
      Attached Files

      Comment

      • longedge
        Indigo Rose Customer
        • Aug 2003
        • 2498

        #4
        One approach would be to control whether the global function is 'activated' by using a variable as in my update to your example.

        Comment

        • thetford
          Forum Member
          • Feb 2005
          • 175

          #5
          Worked like a charm! thanks!:yes

          I'll get the hang of this stuff one day!

          Comment

          Working...
          X