Jump to content

wpFormatDragItem

From EDM2
Revision as of 01:43, 17 November 2025 by Martini (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This instance method is called to allow the object to format its drag information when the user starts to drag it.

Syntax

_wpFormatDragItem(somSelf, pdrgItem)

Parameters

somSelf (WPObject *) - input
Pointer to the object on which the method is being invoked.
Points to an object of class WPObject.
pdrgItem (PDRAGITEM) - input
Address of the drag item.

Returns

rc (BOOL) - returns
Success indicator.
TRUE Successful completion.
FALSE Error occurred.

How to Override

This method is generally overridden by classes that require special processing to initiate a drag or drop operation.

Usage

This method is generally called only by the system when the user first starts to drag the object.

Example Code

#define INCL_WINWORKPLACE
#include <os2.h>

WPObject *somSelf; /* Pointer to the object on which the method is being invoked. */
PDRAGITEM *pdrgItem; /* Address of the drag item. */
BOOL rc; /* Success indicator. */

rc = _wpFormatDragItem(somSelf, pdrgItem);

Remarks

This method enables the direct manipulation of this object by initializing the DRAGITEM structure.

Example Code

In this example, a unique rendering mechanism format is specified that will only be understood by instances of class **MYFOLDER**.

SOM_Scope BOOL SOMLINK myf_wpFormatDragItem(MYFILE *somSelf,
                PDRAGITEM pdrgItem)
{
/* MYFILEData *somThis = MYFILEGetData(somSelf); */
    MYFILEMethodDebug("MYFILE","myf_wpFormatDragItem");

    parent_wpFormatDragItem(somSelf,pdrgItem);

    /* We do NOT want to really let the workplace shell render
     * our object, so change the rendering mechanism and format
     * to be uniquely ours.
     */

    DrgDeleteStrHandle(pdrgItem->hstrRMF);

    pdrgItem->hstrRMF = DrgAddStrHandle("<DRM_OUROWNSPECIAL,DRF_OBJECT>");

    return( TRUE );
}

Related Methods