SilverScreen Solid Modeler

Callback Routines

Callback Routines

Previous topic Next topic  

Callback Routines

Previous topic Next topic JavaScript is required for the print function  

SilverPlusRect

SilverEngineRect

 

Callback Routines

 

Synopsis

The SilverScreen API has a number of callback routines that call user-supplied handlers that respond to different circumstances. In the days before event handlers this is how work of this nature was accomplished.

 


 

 

Callback routine

Purpose

set_location_change_handler

Called when the position of the 3D cursor changes

set_message_area_configure_handler

Called to create a floating message area

set_message_area_write_handler

Called to write into a floating message area

set_qmessage_handler

Called whenever a quick message is to be displayed. A quick message is an informational text string that is to be displayed in the status area

set_show_error_handler

Called whenever an error message should be displayed to the end-user. The default handler displays the error using the Win32 routine MessageBox

set_status_change_handler

Called when drawing status information changes

set_tempfile_create_handler

Called whenever a temporary file is created

set_tempfile_close_handler

Called whenever a temporary file is closed

 

 

Remarks

These routines are only available to the SilverPlus and SilverEngine development platforms. SilverC cannot change the default routines, and SilverSharp uses event handlers to perform this work.

 

 

See Also

qmessage, error_message

 

 

Header

silver.h

 

 

Example

The following code shows a sample error_message handler, how to install it, and how to invoke it. The other handlers all follow similarly:

 

Win32 C / C++ Code

 

 . . .

 

 // The following function is typical for an error message handler

 

 void SDCCALL MyShowErrorHandler(char *message, char *title)

    {

    ::MessageBeep(MB_ICONHAND);

 

    ::MessageBox(AfxGetMainWnd()->GetSafeHwnd(),

               message,

               title,

               MB_OK | MB_ICONHAND | MB_APPLMODAL);

    }

 

 . . .

 

 // The following line of code would install the above handler

 

 set_show_error_handler(MyShowErrorHandler);

 

 . . .

 

 // Whenever the SilverScreen CAD engine issued an error message, or the

 // SilverScreen API routine error_message was called, the installed error

 // handler shown above would be invoked.

 

 error_message("Testing MyShowErrorHandler");