Ctrl_Update

 

This is the only one of the functions described in this section that is not called by SliceOmatic.  This is a local function that is only called by your other functions.  However since it is fairly important, I believe it should alway be present in your code.

 

The function is called from your "Update_A" and "Update_B" functions, as well as from the other Ctrl functions when they need to update the interface.

 

When it is called directly from your other Ctrl function, you have access to 8 new flags: "UPDATE_USER_1" to "UPDATE_USER_8".

 

Syntax

 

extern "C" __declspec(dllexportint  Ctrl_Update(

          UInt64 flag

)

 

 

Parameters

 

flag

The current "Update Flag" value.  This is an "or" of all the updates that occurred since the last processing of the updates.

 

 

Return value

 

The function returns "0" if an error occurred, "1" otherwise.

 

 

Remarks

 

 

Requirements

 

Header:

          sliceO_include.hpp

 

Library:

          sliceO_Structures.lib

 

 

Example

 

In this example, we use 2 tools, tool_tag and tool_brush, that need a few updates.

 

...

 

static          Tool_Brush          tool_brush ;

static          Tool_Tag          tool_tag( TOOL_TAG_LOCK_AS_ENABLE ) ;

 

...

 

// ----------------------------------------------------------------------------

//

//          Function:          Ctrl_Update

//

//          Parameters:          (void)

//          Returns:          (int)                    0 if error

//

//          This is called each time something has been modified from another

//          control and sliceO Believe it may affect you.

//

// ----------------------------------------------------------------------------

int          Ctrl_Update( UInt64 flag )

{

          // --- Updates that are only done regardless of the interface window status ---

 

          ...

 

          // --- Updates that are only done is the interface window is on ---

          if ( ! Flag_Ctrl_Wnd_On )

                    return( 1 ) ;

 

          // --- Changes that affect both TAGs and Brushes ---

          if ( flag & (UPDATE_CUR_TAG | UPDATE_COLOR_TAG) ) {

                    tool_tag.Update( flag ) ;

                    tool_brush.Update( flag ) ;

          }

 

          // --- Changes that affect the TAGs ---

          if ( flag & (UPDATE_TAG_LABEL | UPDATE_TAG_LOCK) ) {

                    tool_tag.Update( flag ) ;

          }

 

          // --- Changes that affect the Brushes ---

          if ( flag & UPDATE_CUR_BRUSH ) {

                    tool_brush.Update( flag ) ;

          }

 

          // --- Updates that are only done is the interface window is displayed ---

          if ( ! Flag_Ctrl_Visible )

                    return( 1 ) ;

 

          ...

 

          // --- FLAG_USER_1 to FLAG_USER_8 are use for local updates.  For example,

          // if your application feels it need to redraw its entire interface, it can

          // generate the call: "Ctrl_Update( UPDATE_USER_1 ) ;" and catch it here with:

          if ( flag & UPDATE_USER_1 ) {

                    Ctrl_Draw( NULL ) ;

          }

 

          return( 1 ) ;

}

 

...

 

 

See also

 

Ctrl_Blabla