peContext - cWebContextMenu

Provides framework integrated contexts, such as interactions with weblist rows, treeviews and tags

Type: Property (Web Property)

Access: Read/Write

Data Type: WebUIContext

Parameters: None

Syntax
 { WebProperty=Client }
 Property WebUIContext peContext

Web Property Read Access: WebGet peContext to WebUIContextVariable
Web Property Write Access: WebSet peContext to WebUIContextVariable/Value

Read Access: Get peContext to WebUIContextVariable
Write Access: Set peContext to WebUIContextVariable/Value


Description

peContext can specify a better "context" within a control/view.

It provides framework integrated contexts, such as interactions with cWebList rows, cWebMultiSelectList selected rows, cWebTreeViews and cWebTagsForm tags.

Valid Values:

ConstantMeaning
C_WebUIContextCustom (0)custom
C_WebUIContextListHead (1)List Header
C_WebUIContextListRow (2)List Row
C_WebUIContextListFull (3)Full List
C_WebUIContextListSelection (4)List Selection
C_WebUIContextTreeviewFolder (5)TreeView folder
C_WebUIContextTreeviewItem (6)TreeView item
C_WebUIContextTagsFormTag (7)TagsForm Tag


The simplest form to provide a context menu would be something like this (without styling, etc.):

Object oWebListSample is a cWebList
    
    Object oWebColumn1 is a cWebColumn
    End_Object

    Object oWebListContextMenu is a cWebContextMenu
        Set peContext to C_WebUIContextListRow

        Object oDeleteItem is a cWebMenuItem
            Procedure OnClick
                String sRowId
                WebGet psContextValue of oWebListContextMenu to sRowId
                Send DataSetRemoveRow of oWebListSample sRowId
            End_Procedure
        End_Object


peContext is an instance of the enum WebUIContext; which mimics the same behaviours as the Drag and Drop API. peContext specifies what kind of data is requested from the phoControl, relative to the element that should provide that context.

This data is available on the Server through psContextValue. It contains the data that the context provided.

For cWebList, cWebMultiSelectList, cWebTagsForm, and cWebTreeView; the RowId (String) is put into the psContextValue.

For C_WebUIContextListFull, by default the psContextValue will be filled with the RowId string (if available), depending on where the user right-clicked.

If the context is set to custom, psContextValue contains the control name of the clicked on control (or its owned scope) after it opens.

By using a String, custom Web Controls can provide their own data, for example, serialized objects in JSON format. A developer can use this data in any form desired.


About Web Properties
Each web property maintains two values: The regular property value is set during object creation and should not be changed during the lifetime of that object. To access that value, use the standard property Get and Set syntax.
The web property value is the local value stored at each client. This is synchronized to the client's local value whenever a server call is being processed. To access the web property value, use the WebGet and WebSet syntax above instead of the standard Get and Set syntax.