### IAccelerator

  The IAccelerator class represents a set of accelerator keys, which are shortcut keys for running an action. Often these actions match the actions available from a menu.

  A set of accelerator keys is also known as an accelerator table. Use the IAccelerator class to associate an accelerator table defined in a resource library with a window. The accelerator keys are in effect only when the window associated with the accelerator table has the keyboard focus.

  The IAcceleratorTable class also represents an accelerator table. See that class for additional information on accelerator tables.

### IAccelerator - Member Functions and Data by Group

### Constructors & Destructor

You can construct and destruct objects of this class. You cannot copy or assign IAccelerator objects because both the copy constructor and assignment operator are private functions.

The constructors accept a window that uses the accelerator keys. The accelerators are only in effect when the specified IWindow object has the input focus.
Note: When an application destructs the IAccelerator object, the IAccelerator object destroys the underlying accelerator table. Therefore, the following does not work:

    IAccelerator* pac1 = new IAccelerator(myAccelRes);
    IAccelTblHandle haccel1 = pac1->accel();
    delete pac1;
    pac1 = new IAccelerator(haccel1);
             // The accelerator handle (haccel1)
             // is no longer valid.

~IAccelerator

      public:
      ~IAccelerator()

  The object and the underlying accelerator table are destroyed. If a window was associated with the accelerator and that window is still valid, its original accelerator table is restored. If, after restoring the original accelerator table, there is a saved accelerator table that is not in use, that table is also destroyed.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

IAccelerator

  Overload 1

      public:
      IAccelerator( const IResourceId& accelResId,
                    IWindow* owner = 0 )

  Loads an accelerator table from a resource library and assigns it to a window. Use this constructor when you want to load the accelerator table from the resource library of your choice.

  accelResId
    Identifier for an accelerator table resource.
  owner
    The window to which the accelerator table is applied.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

  Overload 2

      public:
      IAccelerator(unsigned long accelResId, IWindow* owner = 0)

  Loads an accelerator table from the default user resource library and assigns it to a window. Use this constructor if you want to load the accelerator table from the resource library returned by ICurrentApplication::userResourceLibrary.

  accelResId
    Identifier for an accelerator table resource in the default user resource library.
  owner
    The window to which the accelerator table is applied.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

  Overload 3

      public:
      IAccelerator( const IAccelTblHandle& haccel = 0,
                    IWindow* owner = 0 )

  Assigns an existing accelerator table to a window. Use this constructor when the accelerator table is already loaded.

  haccel
    Handle for a previously-loaded accelerator table. If 0, the IAccelerator object has no accelerator keys and the accelerator keys associated with the window are not changed. Otherwise the accelerator table is assigned to owner.
  owner
    The window to which the accelerator table is applied.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | No

### Accelerator Tables

Accelerator tables contain a list of shortcut key definitions. You can set, remove, and query the accelerator table currently in use by the object.

handle

      public:
      IAccelTblHandle handle() const

  Returns a handle to the accelerator table.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

isSet

      public:
      bool isSet() const

  If the accelerator table is assigned to a window, true is returned (calling owner returns the window). This function returns false if you have removed the accelerator table by calling remove or reset.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

remove

      public:
      IAccelerator& remove()

  Removes the accelerator table without restoring the one that was previously in effect. Calling this function destroys the underlying accelerator table. If you then try to use the IAccelTblHandle after removing it, an exception is thrown.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

reset

      public:
      IAccelerator& reset()

  Removes the accelerator table and restores the one that was in effect before the previous call to set.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

set

  Changes the accelerator keys represented by this object and used by the owner window of this accelerator table. The accelerator table previously used by the IAccelerator object is saved, and can be restored by calling reset.
  Note: Only one previous accelerator table is saved.

  Overload 1

      public:
      IAccelerator& set(const IAccelTblHandle& haccel)

  Use this function when the accelerator table is already loaded.

  haccel
    Handle identifying the loaded accelerator table.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

  Overload 2

      public:
      IAccelerator& set(const IResourceId& accelResId)

  Use this function when you want to specify the resource library that the Open Class Library uses to load the accelerator table.

  accelResId
    Identifier for an accelerator table resource.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

  Overload 3

      public:
      IAccelerator& set(unsigned long accelResId)

  Use this function when you want the Open Class Library to load the accelerator table from the default user resource library (the resource library returned by ICurrentApplication::userResourceLibrary).

  accelResId
    Identifier for an accelerator table resource in the default user resource library.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### Window

You can apply accelerator keys to any window. Only when a window with accelerators has the input focus (or one of its child windows has the input focus) will your pressing an accelerator key cause the command associated with the accelerator key to be run.

owner

      public:
      IWindow* owner() const

  Returns the IWindow using the accelerator table.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### IAccelerator - Inherited Member Functions and Data

#### Inherited Public Functions

  - None

#### Inherited Public Data

  - None

#### Inherited Protected Functions

  - None

#### Inherited Protected Data

  - None