Dynamic MonitorAvailability LightWave® 6.0 The Modeler monitor global returns functions for initializing and displaying a progress dialog in Modeler. See also the monitor global for Layout. Global Call DynaMonitorFuncs *monf; monf = global( LWDYNAMONITORFUNCS_GLOBAL, GFUSE_TRANSIENT ); The global function returns a pointer to a DynaMonitorFuncs. typedef struct st_DynaMonitorFuncs { LWMonitor * (*create) (const char *, const char *); void (*destroy) (LWMonitor *); } DynaMonitorFuncs;
LWMonitor The monitor structure returned by create is defined in the lwmonitor.h header file. typedef struct st_LWMonitor { void *data; void (*init) (void *, unsigned int); int (*step) (void *, unsigned int); void (*done) (void *); } LWMonitor;
Example This code fragment demonstrates the use of a monitor. Macros in lwmonitor.h allow you to call the LWMonitor functions without worrying about whether the create call succeeded. #include <lwserver.h> #include <lwdyna.h> DynaMonitorFuncs *monf; LWMonitor *mon = NULL; monf = global( LWDYNAMONITORFUNCS_GLOBAL, GFUSE_TRANSIENT ); if ( monf ) mon = monf->create( "Hello", "Just fooling around" ); MON_INIT( mon, 100 ); for ( i = 0; i < 100; i += 2 ) { ...do something that takes a long time... if ( MON_INCR( mon, 2 )) break; } MON_DONE( mon ); ... if ( monf && mon ) monf->destroy( mon ); |