Assembly: C1.C1Report.2 (in C1.C1Report.2.dll)
Syntax
C# |
---|
public abstract class ActionHandlerBase |
Visual Basic |
---|
Public MustInherit Class ActionHandlerBase |
Remarks
When a C1PrintDocument containing one or more RenderInputBase-derived objects is shown by a supporting viewer control such as C1PrintPreviewControl, each RenderInputBase object produces a corresponding control on the document page. E.g. a RenderInputText produces a textbox control where the user can enter text, a RenderInputButton produces a pushbutton, and so on.
The functionality of those input controls in the document can be expanded via "action handlers", which are similar to C# or VB event handlers that can be assigned to events on many .NET components. The list of supported events is specified by the UserActionEnum enumeration, and includes mouse click, mouse enter and leave, keyboard focus enter and leave, and mouse up and down events.
To create and attach a handler to a user action on a RenderInputBase-derived object, follow these general steps:
- Create an instance of a ActionHandlerBase-derived class of the concrete type that matches the action that needs to be performed, such as a hyperlink jump or a file operation. (Those classes include ActionHandlerLink, ActionHandlerFileOpen, ActionHandlerFileSave, ActionHandlerPageSetup, ActionHandlerPrint, ActionHandlerReflow, ActionHandlerPageView, ActionHandlerHistoryPrev and ActionHandlerHistoryNext.)
- Some of those classes expose action-specific properties (such as FileName). Adjust the values of those properties as needed.
- Create an instance of the InputAction class, set its UserAction property to the desired user action (such as click or focus enter), and set its ActionHandler property to the ActionHandlerBase instance created in the preceding steps.
- Add the InputAction to the InputActions collection of the RenderInputBase object.
Note that several InputAction objects can be associated with a single render input control.
Examples
C1PrintDocument doc = new C1PrintDocument(); // Create an action handler that would jump to the last page: ActionHandlerLink ahl = new ActionHandlerLink(new C1LinkTargetPage(PageJumpTypeEnum.Last)); // Create an input action, set its properties: InputAction ia = new InputAction(); ia.ActionHandler = ahl; ia.UserAction = UserActionEnum.Click; // Create a button, add the input action to its actions: RenderInputButton rbtn = new RenderInputButton("Jump to last page"); rbtn.InputActions.Add(ia); // Add the button to the document: doc.Body.Children.Add(rbtn); // ...add more content to the document... |
Inheritance Hierarchy
C1.C1Preview..::..ActionHandlerBase
C1.C1Preview..::..ActionHandlerFile
C1.C1Preview..::..ActionHandlerHistoryNext
C1.C1Preview..::..ActionHandlerHistoryPrev
C1.C1Preview..::..ActionHandlerLink
C1.C1Preview..::..ActionHandlerPageSetup
C1.C1Preview..::..ActionHandlerPageView
C1.C1Preview..::..ActionHandlerPrint
C1.C1Preview..::..ActionHandlerReflow