ActiveReports 19 .NET Edition
MESCIUS.ActiveReports.Viewer.Win Assembly / GrapeCity.ActiveReports.Viewer.Win Namespace / Viewer Class / SetShortcutCommandState Method
The ViewerCommand for which to set the enabled state.
If true, the command is enabled; otherwise, it is disabled.
Example

In This Topic
    SetShortcutCommandState Method
    In This Topic
    Sets the enabled or disabled state of a specified viewer command.
    Syntax
    'Declaration
     
    Public Sub SetShortcutCommandState( _
       ByVal viewerCommand As ViewerCommand, _
       ByVal state As Boolean _
    ) 
    public void SetShortcutCommandState( 
       ViewerCommand viewerCommand,
       bool state
    )

    Parameters

    viewerCommand
    The ViewerCommand for which to set the enabled state.
    state
    If true, the command is enabled; otherwise, it is disabled.
    Exceptions
    ExceptionDescription
    Thrown if the toolbar shortcut storage has not been initialized.
    Remarks
    This method allows for the dynamic enabling or disabling of commands within the viewer, which can be useful for adjusting the available actions based on the current state or selection within the viewer. For example, disabling a 'Print' command when no document is loaded.
    Example
    // Assuming 'viewer' is an instance of Viewer.
    // Enabling the Print command.
    viewer.SetShortcutCommandState(ViewerCommand.Print, true);
    // Disabling the ZoomIn command.
    viewer.SetShortcutCommandState(ViewerCommand.ZoomIn, false);
    See Also