| Cogent Tools Demo and Tutorials: Version 4.0 | ||
|---|---|---|
| Prev | Chapter 9. Common Functions for Any Program (in lib/common.g) | Next |
/*--------------------------------------------------------------------
* Function: start_stop
* Returns: t or nil
* Description: Used by control buttons to call the start_process()
* and stop_processes() functions.
*------------------------------------------------------------------*/
function start_stop(button, prog, process_name, args...)
{
local child;
if (button.switched_on())
start_process (button, prog, process_name, args);
else
stop_processes(prog, process_name);
}
If a toggle button is pressed in, it becomes active (ie. the switched_on method returns true), and we want its associated process to start. The program calls the start_process function to start the process, passing along the necessary arguments.
If the user untoggles (releases) a toggle button, the switched_on method becomes FALSE, and we call the stop_processes to stop the process associated with the button.
| Prev | Home | Next |
| Starting qserve and nserve - start_qnserves | Up | Start a Process - start_process, find_on_path |