Spread 8.0 Documentation
CTCreateRendererControl Event
Support Options
ActiveX Reference > ActiveX Events > CTCreateRendererControl Event

Glossary Item Box

CTCreateRendererControl Event


See Also

Applies To

fpSpread control

Description

Occurs when a custom cell type should create the renderer control.

Syntax

C++

afx_msg void OnCTCreateRendererControlfpSpread(LPCTSTRName, long Style, long CtrlId, VARIANT FAR*RendererControl);

Visual Basic

Sub fpSpread_CTCreateRendererControl(ByVal Name AsString, ByVal Style As Long, ByVal CtrlId As Long,RendererControl As Variant)

Parameters

The following parameters are available:

Parameter Description
Name Name of the custom cell type
Style Style for the cell
CtrlId Value to use for the control ID
RendererControl Renderer control to use for editing the cell

Remarks

Create a separate instance of the control to use in rendering the custom cell.This is needed only if the cell type will be used in more than one cell and only if the CTPaintCell event is not handling the painting of the cell when it is not being edited.If a renderer control is used, then the CTPaintCell event is not necessary. If the renderer control is an active x control, then Spread will attempt to display it in the cell using a WM_PRINT message. If that fails, then code would be needed in CTPaintCell to draw the control.

If the window supports the WM_PRINT message, then Spread can handle the drawing of the custom cell content and you do not need to implement code in the CTPaintCell event or you can write code in the CTPaintCell event which uses the PaintControl method to draw the renderer control and paint additional custom content.

The control must use the specified control id. Spread will set the control id to this id internally and use it to lookup the control later.

The CtrlId specifies the control id to use when creating a window using CreateWindow to create the editor control as a child window of the Spread control. The id is passed into the hMenu parameter for CreateWindow or CreateWindowEx and it should have a unique value for each child window.

If you use CreateWindow or CreateWindowEx to create the window for the renderer control (which is a child window of the Spread control), then you need to use the specified control id as the hMenu parameter to CreateWindow to avoid conflicts with the control ids of other custom cell controls. All built-in cell types that use controls create their controls in this manner.

If this event does not return a renderer control, then the Spread control will attempt to create an instance using the custom cell type name as the class. The class should be previously registered with RegisterClass. If not, you will get a null.

Note: The RendererControl parameter can be set to a reference to an ActiveX control to use for editing the cell on your form, or it can be set with the window handle of a control window to use. If an ActiveX control is used, then it must have a window handle associated with it (windowless controls are not supported) and it must expose this handle through a property named "hWnd" or "Handle" so that Spread can get this handle. Use the ActiveX control instance for the RendererControl parameter rather than the hWnd since ActiveX controls may destroy and recreate their window handles and make this handle invalid.

This event does not fire for custom cell types that use False for the UseRendererControl parameter in the AddCustomCellType function.

See Also

SheetSendingEvent property

SS_CT_CREATERENDERERCONTROL_ARGS structure

CTCancelEditing events

Copyright © GrapeCity, inc. All rights reserved.