#include <xsi_ppgeventcontext.h>
This object is provided as the context object in the PPGEvent callback for a Plugin-based CustomProperty object (see PluginRegistrar::RegisterProperty).
Using the information provided by this object, it is possible to implement PPG logic code using the C++ API. For information about implementing logic with scripting see PPGLayout::PutLogic and PPG.
The PPGEventContext::GetEventID function returns information about the specific event that occurred. If the event is PPGEventContext::siOnInit or PPGEventContext::siOnClosed then Context::GetSource returns the CustomProperty object that is being inspected. If the event is PPGEventContext::siParameterChange then Context::GetSource returns the Parameter that changed. If the event is PPGEventContext::siButtonClicked then call Context::GetAttribute to get the attribute "Button", which will return a CString with the script name of the Button that was clicked. If the event is PPGEventContext::siTabChange then call Context::GetAttribute to get the attribute "Tab", which will return a CString with the label of the Tab that was clicked.
If the event is a grid data event ( PPGEventContext::siGridDataOnBeginValueChange, PPGEventContext::siGridDataOnEndValueChange, PPGEventContext::siGridDataOnBeginSelectionChange, PPGEventContext::siGridDataOnEndSelectionChange, PPGEventContext::siGridDataOnButtonClicked, PPGEventContext::siGridDataOnHeaderDoubleClick, PPGEventContext::siGridDataOnContextMenuInit, PPGEventContext::siGridDataOnContextMenuSelected ), then Context::GetSource will return the parameter containing the GridData object. Extra parameters can be retrieved with a call to Context::GetAttribute to get the attribute "ExtraParams", which will return a CValueArray with extra parameters. The first element of the "ExtraParams" array is another CValueArray containing a list of column/row pairs (LONG/LONG) on which the grid data event occurs. If the event is PPGEventContext::siGridDataOnContextMenuSelected, the second element in the "ExtraParams" array contains a LONG value equal to the ID of the selected contextual menu item.
Certain grid data events can also return values to Softimage by calling Context::PutAttribute to set the attribute "Return". PPGEventContext::siGridDataOnBeginValueChange can return a boolean this way to indicate whether the value change should occur (true to allow the modification to all the modified cells and false to prevent it). It can also return a CValueArray made out of one boolean value per modified cell. The same logic applies to PPGEventContext::siGridDataOnBeginSelectionChange, where the return value will dictate whether the cells will get selected or not. Finally, Softimage expects PPGEventContext::siGridDataOnContextMenuInit to return the definition of the contextual menu to display. A CValueArray made out of Name/ID pairs (CString/LONG) will define the menu items.
To force the user interface to be redrawn, call Context::PutAttribute to set the attribute "Refresh" to true. This is useful if the context code changes the underlying PPGLayout during its execution. Similarly, it is possible to close the Property Page by setting the attribute "Close". For the equivalent functionality in scripting see PPG.Refresh and PPG.Close.
The OnChange callback for parameters is only invoked when a user is currently inspecting the property page. However, it may be either the user who changed the value on the inspected page or a change initiated through scripting (excluding a change originating from a callback function, of course). For example, if Parameter X is changed, and the callback code sets Parameter Y to the same value as X, then the PPGEvent is not invoked a second time.
Public Types |
|
enum |
PPGEvent { siUndefined = 0, siOnInit = 1, siOnClosed = 2, siParameterChange = 3, siButtonClicked = 4, siTabChange = 5, siGridDataOnBeginValueChange = 6, siGridDataOnEndValueChange = 7, siGridDataOnBeginSelectionChange = 8, siGridDataOnEndSelectionChange = 9, siGridDataOnButtonClicked = 10, siGridDataOnHeaderDoubleClick = 11, siGridDataOnContextMenuInit = 12, siGridDataOnContextMenuSelected = 13 } |
Public Member Functions |
|
PPGEventContext () | |
~PPGEventContext () | |
PPGEventContext (const CRef &in_ref) | |
PPGEventContext (const PPGEventContext &in_obj) | |
bool | IsA (siClassID in_ClassID) const |
siClassID | GetClassID () const |
PPGEventContext & | operator= (const PPGEventContext &in_obj) |
PPGEventContext & | operator= (const CRef &in_ref) |
PPGEvent | GetEventID () const |
CRefArray | GetInspectedObjects () const |
enum PPGEvent |
Defines the possible actions that result in the callback function being called.
siUndefined |
Unknown event |
siOnInit |
PPG has just been drawn |
siOnClosed |
PPG has just been closed |
siParameterChange |
Value of a Parameter has changed |
siButtonClicked |
The user clicked a button |
siTabChange |
User changed tabs on a multi-tab PPG |
siGridDataOnBeginValueChange |
GridData OnBeginValueChange event occured |
siGridDataOnEndValueChange |
GridData OnEndValueChange event occured |
siGridDataOnBeginSelectionChange |
GridData OnBeginSelectionChange event occured |
siGridDataOnEndSelectionChange |
GridData OnEndSelectionChange event occured |
siGridDataOnButtonClicked |
GridData OnButtonClicked event occured |
siGridDataOnHeaderDoubleClick |
GridData OnHeaderDoubleClick event occured |
siGridDataOnContextMenuInit |
GridData OnContextMenuInit event occured |
siGridDataOnContextMenuSelected |
GridData OnContextMenuSelected event occured |
PPGEventContext | ( | ) |
Default constructor.
~PPGEventContext | ( | ) |
Default destructor.
PPGEventContext | ( | const CRef & | in_ref | ) |
Constructor.
in_ref | constant reference object. |
PPGEventContext | ( | const PPGEventContext & | in_obj | ) |
Copy constructor.
in_obj | constant class object. |
bool IsA | ( | siClassID | in_ClassID | ) | const [virtual] |
Returns true if a given class type is compatible with this API class.
in_ClassID | class type. |
Reimplemented from Context.
siClassID GetClassID | ( | ) | const [virtual] |
PPGEventContext& operator= | ( | const PPGEventContext & | in_obj | ) |
Creates an object from another object.
in_obj | constant class object. |
PPGEventContext& operator= | ( | const CRef & | in_ref | ) |
Creates an object from a reference object. The newly created object is set to empty if the input reference object is not compatible.
in_ref | constant class object. |
Reimplemented from Context.
PPGEvent GetEventID | ( | ) | const |
Returns information about what specific occurrence in the user interface provoked the callback. For additional information use Context::GetSource and Context::GetAttribute.
CRefArray GetInspectedObjects | ( | ) | const |
Returns an array containing the CustomProperty objects being inspected by a Property Page. The only case where the array will contain more than one object is if the Property Page is in Multi-edit mode. This should not be confused with the case where a single Property Page frame is inspecting multiple objects at the same time, one above the other.