The exit-task method allows you to exit the task list manager. It is invoked by choosing File > Exit. The definition of this method is quite simple.
define method exit-task (gadget :: <gadget>) => () let frame = sheet-frame(gadget); let task-list = frame-task-list(frame); save-file (gadget); exit-frame(frame) end method exit-task;
Add this method to the file frame.dylan.
The method takes the gadget used to invoke it and returns no values. In this case, exit-task is only ever invoked by the exit-menu-button gadget.
As with many other callbacks in this example, exit-task sets a number of local variables:
frameThe frame that the gadget argument belongs to.
task-list The task list associated with frame.
The method begins by calling the save-file method (defined in Section 5.3.1.2) to save the current task list to disk. This ensures that the user does not lose any work. Next, the exit-frame generic function is invoked to exit the task list manager window.