SilverScreen Solid Modeler

MessageAreaConfigure Event

MessageAreaConfigure Event

Previous topic Next topic  

MessageAreaConfigure Event

Previous topic Next topic JavaScript is required for the print function  

SilverSharpAPI

 

The MessageAreaConfigure Event

 

Synopsis

The MessageAreaConfigure event is raised whenever SilverSharp wishes to create or destroy a message area. A message area is created or destroyed in response to the SilverScreen API routine message_area_configure.

 

 

Delegate

The MessageAreaConfigure delegate is declared as follows:

 

C# Code

   

delegate void MessageAreaConfigureEventHandler(int lines, SS_RGB bg_rgb);

 

int    lines;  // The number of message area lines

SS_RGB bg_rgb; // The background color of the message area

 

 

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 MessageAreaConfigure delegate declares a function signature that must be used when installing an event handler for the MessageAreaConfigure event.

 

 

Event

The MessageAreaConfigure event is declared within Events as follows:

 

C# Code

   

static event MessageAreaConfigureEventHandler MessageAreaConfigure;

 

 

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

 

 

Raise method

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

 

C# Code

   

static void RaiseMessageAreaConfigure(int lines, SS_RGB bg_rgb);

 

int    lines;  // The number of message area lines

SS_RGB bg_rgb; // The background color of the message area

 

 

The SilverSharp assembly will automatically raise the MessageAreaConfigure event when a message area needs to be created or destroyed. 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 MessageAreaConfigure event, but you must do so if you wish to call SilverScreen API routines that work with a message area.

 

 

See Also

Events, set_message_area_configure_handler, message_area_configure

 

Example

The following code shows a sample MessageAreaConfigure event handler. The implementation of DestroyMessageArea and CreateMessageArea 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 OnMessageAreaConfigure(int line, SS_RGB bg_rgb)

  {

  DestroyMessageArea();

 

  if ( lines > 0 )

     CreateMessageArea(lines, bg_rgb);

  }

 

 

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

 

C# Code

   

Events.MessageAreaConfigure +=

  new MessageAreaConfigureEventHandler(OnMessageAreaConfigure);

 

 

 

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

 

 

C# Code

   

Events.MessageAreaConfigure -=

  new MessageAreaConfigureEventHandler(OnMessageAreaConfigure);