Toggling the Checkmark

If you want to write an action function to perform some task and then toggle the checkmark, you can simply call CHECKMARK() from your action function.

You can also toggle the checkmark yourself by first setting the status of the checkmark for the menu field and then, if the menu is displayed, informing the system that the menu needs to be updated. Use the function sf_opt() to toggle the checkmark status, and smn_opt() to inform the system that the menu has been altered. The two functions are as follows:

void sf_opt(options, state, mfldp)
 
long options;
/* Option(s) to change
*/
int state;
/* Status of option, ON or OFF
*/
MFIELDPTR mfldp;
/* Menu field to change status of
*/

Specify MNCHECKSTATUS as the option to change in sf_opt().

void smn_opt(options, state, mfmp)
 
long options;
/* Option(s) to change
*/
int state;
/* Status of option, ON or OFF
*/
MFORMPTR mfmp;
/* Menu form that was altered
*/

Specify FMALTERED as the option to change, and ON as the state, in the call to smn_opt().

For instance, the following code example illustrates how to change the checkstatus of mfldp, a menu field in the menu form mfmp:

sf_opt(MNCHECKSTATUS, ON, mfldp);

smn_opt(FMALTERED, ON, mfmp);

Note: If you are changing the checkmark status of a menu field that is on a menu that is not currently displayed, you do not have to inform the system that the menu has been altered.


Home Contents Previous Next