SilverScreen Solid Modeler

MessageAreaWrite Event

MessageAreaWrite Event

Previous topic Next topic  

MessageAreaWrite Event

Previous topic Next topic JavaScript is required for the print function  

SilverSharpAPI

 

The MessageAreaWrite Event

 

Synopsis

The MessageAreaWrite event is raised whenever SilverSharp wishes to write text to a message area. Text is written in a  message area in response to the SilverScreen API routine message_area_write.

 

 

Delegate

The MessageAreaWrite delegate is declared as follows:

 

C# Code

 

 delegate void MessageAreaWriteEventHandler(string message,

                                            int    line,

                                            SS_RGB fg_rgb);

 

 string message; // A message string to write in the message area    

 int    line;    // A message area line-number

SS_RGB fg_rgb;  // The foreground color of the message

 

 

A delegate is similar to a C/C++ function pointer, but delegates are type-safe and can only refer to a method that matches the signature of the delegate. The MessageAreaWrite delegate declares a function signature that must be used when installing an event handler for the MessageAreaWrite event.

 

 

Event

The MessageAreaWrite event is declared within Events as follows:

 

C# Code

   

 static event MessageAreaWriteEventHandler MessageAreaWrite;

 

 

MessageAreaWrite allows your application to subscribe to or unsubscribe from the MessageAreaWrite event.

 

 

Raise method

The method to raise the MessageAreaWrite event is declared within Events as follows:

 

C# Code

   

 static void RaiseMessageAreaWrite(string message, int line, SS_RGB bg_rgb);

 

 string message; // A message string to write in the message area    

 int    line;    // A message area line-number

SS_RGB fg_rgb;  // The foreground color of the message

 

 

The SilverSharp assembly will automatically raise the MessageAreaWrite event when a message is to be written into the message area. It would not be typical for a SilverSharp application to raise the event itself.

 

 

Remarks

It is not necessary for a SilverSharp application to establish a handler for the MessageAreaWrite event, but you must do so if you wish to call SilverScreen API routines that write into the message area.

 

 

See Also

Events, set_message_area_write_handler, message_area_write

 

Example

The following code shows a sample MessageAreaWrite event handler. The implementation of WriteToMessageArea  is not shown. Note that the method declaration must match the delegate for this event in parameters and return type:

 

C# Code

   

 using SilverSharp;

 

 . . .

 

 void OnMessageAreaWrite(string message, int line, SS_RGB fg_rgb)

    {

    WriteToMessageArea(message, line, fg_rgb)

    }

 

 

The following example shows how to subscribe to the MessageAreaWrite event, assigning the above handler:

 

C# Code

   

 Events.MessageAreaWrite +=

    new MessageAreaWriteEventHandler(OnMessageAreaWrite);

 

 

The following example shows how to unsubscribe from the MessageAreaWrite event, removing the above handler:

 

 

C# Code

   

 Events.MessageAreaWrite -=

    new MessageAreaWriteEventHandler(OnMessageAreaWrite);