Activate and suspend functions take one parameter, a pointer to the window being activated or suspended. They return an integer value of either 0 or 1. The calling convention is as follows:
|
Your function should return a 1, or TRUE, if it succeeds, and a 0, or FALSE, if an unrecoverable error occurs. If your function returns a 0 or FALSE value, processing on the window will stop immediately. You can set the global VV_ERR to indicate the type of error that occurred. You can use one of the pre-defined error codes, or you can add your own error codes and messages. For more information on using VV_ERR to display error messages, see Chapter 50, "Debugging and Error Handling."
Activate and suspend functions can be installed for windows, data forms, and menu forms. In each case, the function receives a pointer to the window. Inside your activate or suspend function, you can get a pointer to the data or menu form by dereferencing the owner pointer in the window structure, using wnp->ownerp. For data form windows and menu form windows, this pointer points to the form. For simple windows, there is no owner and this pointer is a NULLP.
Activate and suspend functions are installed on windows. Data forms and menus have windows associated with them. To get a pointer to the window associated with a data form or menu, reference the wnp member of the form structure, fmp->wnp.
Designer: You can attach activate and suspend functions to your windows, data forms and menu forms in the Designer by selecting MODIFY->Current form->User functions and entering the name of the function to attach.
Code: To install an activate window function, call the function sw_actfp():
|
||
|
|
|
|
|
|
To install a window suspend function, call the function sw_susfp():
|
||
|
|
|
|
|
|