A small tip, anytime you have a Notification message, they are
always sent to the Parent window, so you don't have to subclass the
control in this case.
An example for just a plain header control. This should give you enough
info to get you started on the ListView.
Code:
'--- %ID_HEADCONTROL = 500 '--- local hdnptr as HD_NOTIFY PTR local hdiptr as HD_ITEM PTR local hditem as HD_ITEM local lo as HD_LAYOUT '--- ... '--- CASE %WM_NOTIFY select case lowrd(wParam) case %ID_HEADCONTROL hdnptr = lParam hdiptr = @hdnptr.pitem select case @hdnptr.hdr.code case %HDN_ENDTRACK If (@hdiptr.cxy < %MINWIDTH) THEN @hdiptr.cxy = %MINWIDTH Columns(@hdnptr.iItem) = %MINWIDTH Else Columns(@hdnptr.iItem) = @hdiptr.cxy Call GetClientRect(ghWndMain,rc) rc.ntop = HeaderHeight Call InvalidateRect(ghWndMain,rc,%TRUE) 'UpdateWindow ghWndMain End if 'Function = 0 'Exit Select case %HDN_TRACK Call GetClientRect(ghWndMain,rc) If(@hdiptr.cxy < %MINWIDTH) THEN @hdiptr.cxy = %MINWIDTH Columns(@hdnptr.iItem) = %MINWIDTH Else Columns(@hdnptr.iItem) = @hdiptr.cxy rc.ntop = HeaderHeight 'Call InvalidateRect(ghWndMain,rc,%TRUE) 'UpdateWindow ghWndMain End If 'Function = 0 'Exit Select case %HDN_ITEMCLICK hditem.mask = %HDI_WIDTH Call SendMessage(ghHeadWnd, %HDM_GETITEM, @hdnptr.iItem, VARPTR(hditem)) hditem.cxy = %DEFWIDTH Columns(@hdnptr.iItem) = %DEFWIDTH Call SendMessage(ghHeadWnd, %HDM_SETITEM, @hdnptr.iItem, VARPTR(hditem)) Call GetClientRect(ghWndMain,rc) rc.ntop = HeaderHeight Call InvalidateRect(ghWndMain,rc,%TRUE) UpdateWindow ghWndMain 'Function =0 'Exit Select case %HDN_ITEMDBLCLICK hditem.mask = %HDI_WIDTH Call SendMessage(ghHeadWnd, %HDM_GETITEM, @hdnptr.iItem, VARPTR(hditem)) hditem.cxy = hditem.cxy + hditem.cxy If (hditem.cxy > %MAXWIDTH) THEN hditem.cxy = %MAXWIDTH End If Columns(@hdnptr.iItem) = hditem.cxy Call SendMessage(ghHeadWnd, %HDM_SETITEM, @hdnptr.iItem, VARPTR(hditem)) Call GetClientRect(ghWndMain,rc) rc.ntop = HeaderHeight Call InvalidateRect(ghWndMain,rc,%TRUE) UpdateWindow ghWndMain 'Function = 0 'Exit Select End Select End Select
HTH
Regards, Jules
[This message has been edited by Jules Marchildon (edited September 05, 2000).]
Leave a comment: