Opening a Custom View of an Object

HWND    hView;                                  /* View window handle    */

typedef struct _OBJECTVIEW                      /* Object view structure */
               {
               SOMAny   *Object;                /* Object pointer        */
               USEITEM  UseItem;                /* USEITEM structure     */
               VIEWITEM ViewItem;               /* VIEWITEM structure    */
               } OBJECTVIEW;

OBJECTVIEW *pObjectView;                        /* Pointer to structure  */

<Create Window>                                 /* Get window handle     */

pObjectView = _wpAllocMem(somSelf,              /* Allocate memory       */
                          sizeof(OBJECTVIEW),   /* Size of mem object    */
                          NULL);
pObjectView->Record          = somSelf;         /* Initialize OBJECTVIEW */
pObjectView->UseItem.type    = USAGE_OPENVIEW;  /* structure             */
pObjectView->ViewItem.view   = OPEN_CUST;
pObjectView->ViewItem.handle = hView;

WinSetWindowULong(hView,                        /* Store pointer to      */
                  QWL_USER,                     /* structure in window   */
                  (ULONG)pObjectView);          /* words                 */

_wpAddToObjUseList(somSelf,                     /* Add to Use List       */
                   &pObjectView->UseItem);      /* USEITEM structure     */
_wpRegisterView(somSelf,                        /* Register view         */
                hView,                          /* View window handle    */
                "Customer Details")             /* Title of view         */


[Back: Opening an Object]
[Next: Automatically Instantiating an Object]