Open topic with navigation
Methods are subroutines you write, but they aren’t something you call from your program. Rather, Toolkit calls them automatically when certain events take place. Some methods are called immediately when a given event takes place. Others aren’t called until Toolkit is ready. Methods are documented throughout this manual, but this appendix discusses issues common to types of methods.
Asynchronous methods are called as soon as their events take place. For example, if you’ve written an arrive method for a field, the arrive method is called immediately when the user arrives on the field. Asynchronous methods include the following:
Within asynchronous methods on Windows, it’s best to avoid doing any user‑interactive processing (with the possible exception of a highly conditional message box). Asynchronous methods need to be self contained and they need to execute quickly because they are triggered by Windows events, so it is difficult to determine exactly when the method might be used in relation to your code and Toolkit code. See Notes on input methods for more restrictions.
Synchronous methods are not called when their events take place, but are deferred until Toolkit is ready to call them. For example, if you write a drill method for an input field, the method will not be called immediately when the user clicks the drilldown button or selects the drilldown menu entry. Instead, if the input field is in focus, the leave method for the field is first invoked, then the drill method is called. Synchronous methods include the following: