Condividi tramite


CommandTargetQuery Event

Occurs when an Active Document host updates its user interface.

PROCEDURE Object.CommandTargetQuery
LPARAMETERS aCommands, nCommandTextFlag, cCommandTextOut

Parameters

  • aCommands
    A two-dimensional array containing a list of commands supported by the Active Document host.

    The first column of the array contains numeric values that correspond to the commands supported by the Active Document host. For a list of the commands and their numeric values, see the nCommandID parameter in CommandTargetExec Event.

    The second column of the array contains numeric values that correspond to the support status for each of the commands. The following table lists the values that the second column can contain and the corresponding support status for the commands.

    Value FOXPRO.H Constant Description
    0 CMDF_NOTSUPPORTED The command is not supported by this object.
    1 CMDF_SUPPORTED The command is supported by this object.
    2 CMDF_ENABLED The command is available and enabled.
    4 CMDF_LATCHED The command is an on-off toggle and is currently on.
    8 CMDF_NINCHED The command is an on-off toggle but the state cannot be determined because the attribute of this command is found in both on and off states in the relevant selection. This state corresponds to an "indeterminate" state of a 3-state check box, for example.

    The second column of the array initially contains zero for all commands except CMDID_PROPERTIES. Your event code should store a value to the second column to indicate the level of support provided by the Active Document for each command. You can add any combination of these values together to specify additional levels of support. For example, your Active Document procedure for a command is supported (1), and available and enabled (2), store 3 (1 + 2) to the second column for the corresponding command.

    You can also disable the File menu Properties menu item by setting the aCommands column-2 value for CMDID_PROPERTIES to 0. The default coulumn-2 value for CMDID_PROPERTIES is 3 in order to support the default About dialog box. For more information on handling CMDID_PROPERTIES, see the CommandTargetExec Event.

  • nCommandTextFlag
    A parameter passed from the Active Document host to the CommandTargetExec event. nCommandTextFlag indicates the type of command information to pass to the Active Document host via the cCommandTextOut parameter. The following table lists the values for nCommandTextFlag and the corresponding command information to pass to the Active Document host.

    nCommandTextFlag Command Information
    0 No extra information is requested.
    1 The Active Document should provide the localized name for the command.
    2 The Active Document should provide a localized status bar string for the command.
  • cCommandTextOut
    A parameter passed from the CommandTargetExec event to Active Document host. cCommandTextOut is the text that is displayed for a command, usually in the Active Document host's status bar. cCommandTextOut applies to the command in the first row of the array.

Remarks

The CommandTargetQuery event lets you notify an Active Document's host, which, commands the Active Document, can support, and what type of support is available for each command. You can also specify the text that is displayed when a command (typically a menu item) is selected.

Visual FoxPro utilizes the IOleCommandTarget interface for the CommandTargetExec and CommandTargetQuery events. Search for IOleCommandTarget in the MSDN library for additional information about how these events are implemented.

Note that Internet Explorer versions 3 and 4 typically don't request the command text via cCommandTextOut. Therefore, nCommandTextFlag is typically zero and cCommandTextOut typically contains the null value. These parameters are included for future compatibility with the IOleCommandTarget interface, and can be safely ignored in your applications.

See Also

CommandTargetExec Event | Active Documents

Applies To: ActiveDoc Object