FX_CONCALLBACK(MyEditControlFnc) // expands to: FXint MyEditControlFunc( FXcontrol ctl, FXentity ctl_data, FX_Arg *arg, FXint64 entry ) { // module this control belongs to FXeffect effect = (FXeffect)ctl_data; // data attached to the module MyEffectData *med = fxObjectGetTypeData(effect, FX_NOFLAG); switch( entry ) { // Value of the control has changes, retrieve it and store it in our module's internal data case ACC_VALUE: { fxConGetString( ctl, med->editCtlString, MED_STRING_LEN ); } break; // Control needs to be updated and needs us to tell it what its value should be case ACC_UPDATE: { fxConSetString( ctl, med->editCtlString ); } break; } }
switch
statement. We use the functions fxConGetString() and fxConSetString() to get and set the value of the control in response to the appropriate CN.FX_ACCESSFUNC(MyAccessFunc) { switch( level ) { case ACCESS_INTERFACE: switch( entry ) { case IN_CREATE: { FXcontrol block; // Create a new block block = fxCC_Block("MyBlock", NULL, ACC_NONE, FX_NOFLAG); } break; }// switch entry break; }// switch level return ENTRY_OK; }
// ... case IN_CREATE: { FXcontrol block, helloButton; // create the block to place the button on block = fxCC_Block( "Obligatory", NULL, ACC_NONE, FX_NOFLAG ); // now create the button, passing it the address of our control_func() // and the ACC_VALUE flag indicating that we want to recieve that message helloButton = fxCC_Button( "Click Me", &HelloButton_cb, ACC_VALUE, 150 ); } // ... FX_CONCALLBACK(HelloButton_cb) { switch( entry ) { case ACC_VALUE: // button was clicked { fxMessageSend( FX_NULLID, NULL, FX_MESSAGE_POST, "Hello World!", NULL ); } break; } return ENTRY_OK; }
helloButton = fxCC_Button( "Click Me", &HelloButton_cb, ACC_VALUE|ACC_UPDATE, 150 );
fxInterfaceBlockSet( FX_MODE_ANIMATE, NULL, NULL, block ); fxInterfaceBlockSet( FX_MODE_SETUP, NULL, NULL, block );
fxInterfaceBlockSet(FX_MODE_ANIMATE, FX_MODE_ANIMATE, FX_MBLOCK_SPLINE, NULL);
© 2003 pmG WorldWide,
LLC.
|
Last
Updated on Thu Jul 10 04:49:36 2003
|