Hide

SftTree/DLL 7.5 - Tree Control

Display
Print

SFTTREE_VIRTUALDEF Structure

The SFTTREE_VIRTUALDEF structure is used by VirtualInitialize to use the tree control in virtual mode and to define the virtual data source.

typedef struct tagSftTreeVirtualFuncs {
    DWORD version;
    SFTTREE_DWORD_PTR userdataVirtPool;
    LPFNSFTTREE_VGETITEM         lpfnVGetItem;
    LPFNSFTTREE_VRELEASEITEM     lpfnVReleaseItem;
    LPFNSFTTREE_VGETSTATUS       lpfnVGetStatus;
    LPFNSFTTREE_VSETSTATUS       lpfnVSetStatus;
    LPFNSFTTREE_VINDEXTOVISIBLE  lpfnVCvtIndexToVisible;
    LPFNSFTTREE_VVISIBLETOINDEX  lpfnVCvtVisibleToIndex;
    LPFNSFTTREE_VGETPARENTINDEX  lpfnVGetParentIndex;
    LPFNSFTTREE_VGETNEXTSIBLING  lpfnVGetNextSibling;
    LPFNSFTTREE_VGETPREVSIBLING  lpfnVGetPrevSibling;
    LPFNSFTTREE_VGETFIRSTSIBLING lpfnVGetFirstSibling;
    LPFNSFTTREE_VGETLASTSIBLING  lpfnVGetLastSibling;
    LPFNSFTTREE_VGETITEM_EX      lpfnVGetItemEx;
    LPFNSFTTREE_VRELEASEITEM_EX  lpfnVReleaseItemEx;
    SFTTREE_DWORD_PTR res4, res5, res6;
} SFTTREE_VIRTUALDEF, * LPSFTTREE_VIRTUALDEF;
typedef const SFTTREE_VIRTUALDEF * LPCSFTTREE_VIRTUALDEF;

Members

version

The SftTree/DLL version expected by the application. This value must be set to SFTTREE_VERSION_750, otherwise the call to VirtualInitialize will fail (SFTTREE_VERSION_400, SFTTREE_VERSION_450, SFTTREE_VERSION_500, SFTTREE_VERSION_600 and SFTTREE_VERSION_650 are still accepted as the current version is upward compatible). This version field will be used by future versions of SftTree/DLL to provide upward compatibility for applications designed for earlier versions.

userdataVirtPool

An application defined value. May be 0. This value is used as userData parameter in the callback functions SFTTREE_VGETITEM, SFTTREE_VRELEASEITEM, etc. The value defined here can also be retrieved using GetVirtualUserData.

lpfnVGetItem

A pointer to a callback function SFTTREE_VGETITEM. This function is called by SftTree/DLL to retrieve item information.

lpfnVReleaseItem

A pointer to a callback function SFTTREE_VRELEASEITEM. This function is called by SftTree/DLL to release item information previously retrieved using SFTTREE_VGETITEM.

lpfnVGetStatus, lpfnVSetStatus, lpfnVCvtIndexToVisible, , lpfnVCvtVisibleToIndex, lpfnVGetParentIndex, lpfnVGetNextSibling, lpfnVGetPrevSibling, lpfnVGetFirstSibling, lpfnVGetLastSibling, lpfnVGetItemEx, lpfnVReleaseItemEx, res4, res5, res6

These fields must be set to NULL and are reserved for future use.

Comments

The SFTTREE_VIRTUALDEF structure is used by VirtualInitialize to use the tree control in virtual mode and to define the virtual data source.

All fields marked "reserved for future use" must be initialized to 0 or NULL to insure compatibility with future releases of SftTree/DLL.

SftTree/DLL supports "flat" lists only in virtual mode. Hierarchies cannot be represented in virtual mode.

Examples

C

        /* Resources, such as bitmaps, should be loaded and must remain    */
        /* valid until the tree control is destroyed or no longer uses     */
        /* these.  For example, use DeleteObject to delete any bitmaps.    */

        /* Initialize "virtual" data callback routines.  The       */
        /* routines used are defined below.                        */
        {
            SFTTREE_VIRTUALDEF virt = {
                SFTTREE_VERSION_700,
                0,
                Tree_VirtualStorageGetItemCallback,
                Tree_VirtualStorageReleaseItemCallback,
            };
            if (!SftTreeSplit_VirtualInitialize(g_hwndTree, &virt))
                ; /* error handling goes here */
            /* Set current number of items in the control.             */

C++

    /* these.                                                          */

    /* Initialize "virtual" data callback routines.  The      */
    /* routines used are defined below.  The callbacks are    */
    /* static functions so they don't have a 'this' pointer.  */
    /* We pass the 'this' pointer as userdata for the call-   */
    /* back routine.                                          */
    {
        SFTTREE_VIRTUALDEF virt = {
            SFTTREE_VERSION_700,
            (SFTTREE_DWORD_PTR)(LPVOID)this,
            VirtualStorageGetItemCallback,
            VirtualStorageReleaseItemCallback,
        };
        if (!m_Tree.VirtualInitialize(&virt))
            return -1; /* error handling goes here */

See Also C/C++ API | Categories | Notifications