Skip to content

Is_Function - DEOPopupMenu

Returns a value from MsgId for ObjId

Type: Function
Return Data Type: Integer

Parameters

Parameter Type Description
MsgId Integer The handle of the function name
ObjId Integer The object handle for the message
DelegateFg Integer Determines if delegation can be used to find the message

Syntax

Function Is_Function Integer MsgId Integer ObjId Integer DelegateFg Returns Integer

Call Example

Get Is_Function MsgId ObjId DelegateFg to IntegerVariable

Description

Is_Function is used to return a value from MsgId for ObjId. If the function is not understood a zero will be returned (and an error will not occur). DelegateFg determines if the MsgId message can be delegated if not understood.

This is used to inquire if the object that invoked the menu (the focus object) is a DEO or if the object is a DEO control. This can be used inside of OnInitMenu to shadow items based on the type of invoking object.

To inquire if an object is a DEO the function should be:

Get is_Function Get_DEO_Object Obj# TRUE to IsDeo

To inquire if an object is a DEO control the function should be:

Get is_Function Get_DEO_Control_Object Obj# False to IsDeoControl

You can actually use this to indentify any type of object. Simple assign a unique function to an object or class and make that function return a 1. For example a dbGrid could be assigned the following function:

Function Im_a_Grid
    function_return 1
End_Function

The popup menu could determine if the focus object is a grid with the following code:

Get Focus to Obj#
Get Is_Function Get_Im_a_Grid Obj# False to IsDeoControl

The DelegateFg parameter should be set to true, if it is appropriate for the item message to delegate to a valid parent. For example, it makes sense for any object within a DEO to be considered a DEO object and DelegateFg is set to true. It does not make sense to allow an object inside of a DEO control to be considered a DEO control and DelegateFg is set false.

The following example would disable all items in a menu if the invoking focus object is not a DEO.

Procedure OnInitMenu
    Integer IsDEO iFoc iItems iCount

    Get Focus to iFoc // the object that invoked the popup menu
    Get Is_Function Get_DEO_Object iFoc True to IsDeoControl
    Get Item_Count to iItems
    Decrement iItems
    For iCount from 0 to iItems
        Set Shadow_State iCount to (IsDEO=0) // shadow if NOT a DEO
    Loop
End_Procedure

Return Value

Returns true if function is found