Codeblock Slot fin "C"-Code or Owner Draw ?

46 views
Skip to first unread message

Auge & Ohr

unread,
Sep 6, 2021, 5:13:01 PMSep 6
to Harbour Users
hi,

Owner Draw need DrawItem Structure which i want "to pass" from "C"-Code to *.PRG

---

i saw some Owner Draw Sample under harbour but "Owner" Draw is in "C"-Code and not in *.PRG

so i want to ask it it is possible to use a Codeblock in *.PRG and use Parameter pass from "C"-Code ?

Dummy "C"-Code
----------------------------
   oDrawItemStruct = xxDRAWITEMSTRUCT

   aInfo = { {oDrawItemStruct:itemID+1,nColCount }  ,;  // XBP_DRAWINFO_ITEM
                 oDrawItemStruct:itemAction   ,;  // XBP_DRAWINFO_ACTION
                 oDrawItemStruct:itemState    ,;  // XBP_DRAWINFO_STATE
                {oDrawItemStruct:rcItem:Left, oDrawItemStruct:rcItem:Top, oDrawItemStruct:rcItem:Right, oDrawItemStruct:rcItem:Bottom },;
                 NIL                          ,;  // XBP_DRAWINFO_AREA
                 nColCount                    ,;  // XBP_DRAWINFO_COLUMN
                 oDrawItemStruct:hDC          ,;  // XBP_DRAWINFO_HDC
                 oDrawItemStruct:hwndItem     }   // XBP_DRAWINFO_HWND

   EVAL( drawItem, oDrawItemStruct:hDC , aInfo , Self)

Dummy *.PRG
-----------------------
   oCtrl:MeasureItem := {| nItem, aDims, oSelf | PureMeasureItem(nItem, aDims, oSelf,aPP)  }
   oCtrl:drawItem    := {| hDC  , aInfo, oSelf | PureDrawItem   (hDC  , aInfo, oSelf,aPP)  }

PROCEDURE PureMeasureItem(nItem, aDims, oSelf,aPP)
   // get Size of Item per Referenz aDims
RETURN

PROCEDURE PureDrawItem(hDC, aInfo, oSelf,aPP)
   // Draw "as you like"
RETURN

Jimmy
Reply all
Reply to author
Forward
0 new messages