mclWaitForFiguresToDie

Enable deployed applications to process graphics events, enabling figure windows to remain displayed

Synopsis

void mclWaitForFiguresToDie(HMCRINSTANCE instReserved) 

Description

Calling void mclWaitForFiguresToDie enables the deployed application to process graphics events.

NULL is the only parameter accepted for the MATLAB® Runtime instance (HMCRINSTANCE instReserved).

This function can only be called after libraryInitialize has been called and before libraryTerminate has been called.

mclWaitForFiguresToDie blocks all open figures. This function runs until no visible figures remain. At that point, it displays a warning if there are invisible figures present. This function returns only when the last figure window is manually closed — therefore, this function should be called after the library launches at least one figure window. This function may be called multiple times.

If this function is not called, any figure windows initially displayed by the application briefly appear, and then the application exits.

Note

mclWaitForFiguresToDie will block the calling program only for MATLAB figures. It will not block any Java® GUIs, ActiveX® controls, and other non-MATLAB GUIs unless they are embedded in a MATLAB figure window.

Examples

int run_main(int argc, const char** argv)
{
		int some_variable = 0;
		if (argc > 1)
			 test_to_run = atoi(argv[1]);
    
    /* Initialize application */

    if( !mclInitializeApplication(NULL,0) )
    {
			fprintf(stderr,
						"An error occurred while
								initializing: \n %s ",
						mclGetLastErrorMessage());
			return -1;
		}

		if (test_to_run == 1 || test_to_run == 0)
		{
			/* Initialize ax1ks library */
			if (!libax1ksInitialize())
			{
					fprintf(stderr,
							"An error occurred while
								initializing: \n %s ",
							mclGetLastErrorMessage());
					return -1;
			}
		}

		if (test_to_run == 2 || test_to_run == 0)
		{
			/* Initialize simple library */
			if (!libsimpleInitialize())
			{
					fprintf(stderr,
							"An error occurred while
								initializing: \n %s ",
							mclGetLastErrorMessage());
					return -1;
			}
		}

		/* your code here
		/* your code here
		/* your code here
		/* your code here
		/*
		/* Block on open figures */
			mclWaitForFiguresToDie(NULL);
		/* Terminate libraries */
			if (test_to_run == 1 || test_to_run == 0)
				libax1ksTerminate();
			if (test_to_run == 2 || test_to_run == 0)
				libsimpleTerminate();
		/* Terminate application */
			mclTerminateApplication();
      return(0);
}

See Also

Introduced in R2009a

Was this topic helpful?