A simple text editing application is constructed using VA Smalltalk. The application is responsive in all situations except while reading or writing the file that is being edited. To maintain responsiveness in this situation, file reading and writing are moved to a background process. The operations are modified to use a modal "percentage complete" dialog that is updated by the background process using asyncExecInUI:. When the file has been completely read or written, the background process uses a call to syncExecInUI: to close the dialog.
• Generate a background process that first saves the source to the database, and then uses asyncExecInUI: to re-enable the menus and buttons and set the cursor back to normal.
• If the drawing is too complex to refresh in the UIProcess, the operation changes the cursor to indicate that a refresh operation is "in progress."Notice that in this example, the same code could be used to do the actual refreshing of the drawing, regardless of whether it is being run by the UIProcess or by a background process, because the "ExecInUI" methods can always be called by both background processes and the UIProcess.
|