- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm trying to create a ListView with different text colors for each column (ie, subitem). Here is the
partial dialog proc (CVF6.6) for this exercise:
TYPE(T_NMLVCUSTOMDRAW) :: nmlvcd
POINTER (lParam, nmlvcd)
res = DefaultDialogProc (hwnd, msg, wParam, lParam)
SELECT CASE (msg)
CASE (WM_NOTIFY)
controlId = wParam
SELECT CASE (controlId)
CASE (IDC_VLIST) ! resource id for the LV control
IF (nmlvcd%nmcd%hdr%code == NM_CUSTOMDRAW) THEN
SELECT CASE (nmlvcd%nmcd%dwDrawStage)
CASE (CDDS_PREPAINT)
res = CDRF_NOTIFYITEMDRAW
RETURN
CASE (CDDS_ITEMPREPAINT)
res = CDRF_NOTIFYSUBITEMDRAW
RETURN
CASE (IOR(CDDS_ITEMPREPAINT, CDDS_SUBITEM))
nmlvcd%clrText = new_color ! varies with subitem
res = CDRF_NEWFONT
RETURN
END SELECT
END IF
I think this set of messages and responses follows how MS says it should work. Yet when the list is created
there is one CDDS_PREPAINT msg, then nothing else; the list is drawn correctly, but only in the default color.
Any help or hints on what is wrong/missing in the above would be greatly appreciated.
For reference, here are the custom-draw data types:
! TYPE T_NMLVCUSTOMDRAW
! SEQUENCE
! TYPE (T_NMCUSTOMDRAW) nmcd ! typedefs NMCUSTOMDRAW
! integer(ULONG) clrText ! typedefs COLORREF
! integer(ULONG) clrTextBk ! typedefs COLORREF
! integer(SINT) iSubItem ! knowns int
! END TYPE
! TYPE T_NMCUSTOMDRAW
! SEQUENCE
! TYPE (T_NMHDR) hdr ! typedefs NMHDR
! integer(DWORD) dwDrawStage ! knowns DWORD
! integer(HANDLE) hdc ! handles HDC
! TYPE (T_RECT) rc ! typedefs RECT
! integer(DWORD_PTR) dwItemSpec ! knowns DWORD_PTR
! integer(UINT) uItemState ! knowns UINT
! integer(LONG_PTR) lItemlParam ! knowns LPARAM
! END TYPE
! TYPE T_NMHDR
! SEQUENCE
! integer(HANDLE) hwndFrom ! handles HWND
! integer(UINT) idFrom ! typedefs UINT_PTR
! integer(UINT) code ! knowns UINT
! END TYPE
TIA, Paul Curtis pcurtis@kiltel.com
partial dialog proc (CVF6.6) for this exercise:
TYPE(T_NMLVCUSTOMDRAW) :: nmlvcd
POINTER (lParam, nmlvcd)
res = DefaultDialogProc (hwnd, msg, wParam, lParam)
SELECT CASE (msg)
CASE (WM_NOTIFY)
controlId = wParam
SELECT CASE (controlId)
CASE (IDC_VLIST) ! resource id for the LV control
IF (nmlvcd%nmcd%hdr%code == NM_CUSTOMDRAW) THEN
SELECT CASE (nmlvcd%nmcd%dwDrawStage)
CASE (CDDS_PREPAINT)
res = CDRF_NOTIFYITEMDRAW
RETURN
CASE (CDDS_ITEMPREPAINT)
res = CDRF_NOTIFYSUBITEMDRAW
RETURN
CASE (IOR(CDDS_ITEMPREPAINT, CDDS_SUBITEM))
nmlvcd%clrText = new_color ! varies with subitem
res = CDRF_NEWFONT
RETURN
END SELECT
END IF
I think this set of messages and responses follows how MS says it should work. Yet when the list is created
there is one CDDS_PREPAINT msg, then nothing else; the list is drawn correctly, but only in the default color.
Any help or hints on what is wrong/missing in the above would be greatly appreciated.
For reference, here are the custom-draw data types:
! TYPE T_NMLVCUSTOMDRAW
! SEQUENCE
! TYPE (T_NMCUSTOMDRAW) nmcd ! typedefs NMCUSTOMDRAW
! integer(ULONG) clrText ! typedefs COLORREF
! integer(ULONG) clrTextBk ! typedefs COLORREF
! integer(SINT) iSubItem ! knowns int
! END TYPE
! TYPE T_NMCUSTOMDRAW
! SEQUENCE
! TYPE (T_NMHDR) hdr ! typedefs NMHDR
! integer(DWORD) dwDrawStage ! knowns DWORD
! integer(HANDLE) hdc ! handles HDC
! TYPE (T_RECT) rc ! typedefs RECT
! integer(DWORD_PTR) dwItemSpec ! knowns DWORD_PTR
! integer(UINT) uItemState ! knowns UINT
! integer(LONG_PTR) lItemlParam ! knowns LPARAM
! END TYPE
! TYPE T_NMHDR
! SEQUENCE
! integer(HANDLE) hwndFrom ! handles HWND
! integer(UINT) idFrom ! typedefs UINT_PTR
! integer(UINT) code ! knowns UINT
! END TYPE
TIA, Paul Curtis pcurtis@kiltel.com
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please enclose the code in
I'd like to point you (and other CVF Win32 programmers too) to comp.os.ms-windows.programmer.win32 newsgroup. If you don't have direct NNTP access, there's www interface for it at Google. Chances are better to find answers to Win32-specific questions there (quite a bunch of gurus).
Jugoslav
...tags when posting -- in this way it's unreadable.
I'd like to point you (and other CVF Win32 programmers too) to comp.os.ms-windows.programmer.win32 newsgroup. If you don't have direct NNTP access, there's www interface for it at Google. Chances are better to find answers to Win32-specific questions there (quite a bunch of gurus).
Jugoslav
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page