ListView with muli-line header

Started by James Fuller, February 15, 2010, 02:06:12 PM

Previous topic - Next topic

James Fuller

Here is a Listview Demo project that has a multi-Line header.
The original code was  By Jules Marchildon April/2002 and Inspired by Mark Newman
James

Roger Garstang

I don't use Jose Includes and the custom options in the AppStart stopped it from compiling too.  After I remove that it compiles, but the column headers are blank except one word in Blue about 3/4 the way into the columns.

Jean-pierre Leroy

Hello James,

Thank you for this demo; but on my system I can't see the multi-line header.

See the screenshot.

Jean-Pierre

James Fuller

No Idea what the problem is.
OS here is Win7(64)

James

Rolf Brandt

Rolf Brandt
http://www.rbsoft.eu
http://www.taxifreeware.com
I cook with wine, sometimes I even add it to the food.
(W. C. Fields)

Jean-pierre Leroy

It works if I disable the "Theme support" for the project.

Jean-Pierre

Paul Squires

Quote from: Jean-Pierre Leroy on February 15, 2010, 06:27:39 PM
It works if I disable the "Theme support" for the project.

See - told you (in the other thread about customdraw and XP Themes.
Paul Squires
PlanetSquires Software

José Roca

#7
 
Using a big font to increase the header height is a hack that doesn't work with XP themes.

A more straightforward way is to process the HDM_LAYOUT message, fill the WINDOWPOS structure with the appropriate size and position of the header control, and change the top position of the rectangle that the header control will occupy.


   CASE %HDM_LAYOUT
      LOCAL phdl AS HDLAYOUT PTR
      phdl = lParam
      @phdl.@pwpos.hwnd = hwnd
      @phdl.@pwpos.flags = %SWP_FRAMECHANGED
      @phdl.@pwpos.x = @phdl.@prc.nLeft
      @phdl.@pwpos.y = 0
      @phdl.@pwpos.cx = @phdl.@prc.nRight - @phdl.@prc.nLeft
      @phdl.@pwpos.cy = 40   ' --> change me
      @phdl.@prc.nTop = 40   ' --> change me
      FUNCTION = -1
      EXIT FUNCTION


Attached to this post you will find a modified version of Jules' example.

José Roca

#8
In the James' example, change:


Function HeaderProc( ByVal hWndControl As Dword, _
                       ByVal wMsg   As Dword, _
                       ByVal wParam As Long, _
                       ByVal lParam As Long _
                       ) As Long
   Local hFont As Long
   Select Case wMsg
      Case %WM_SIZE
         hFont = FF_MakeFontEX("Tahoma",%HEADER_HEIGHT,0,0,0,0)
         SendMessage hWndControl,%WM_SETFONT,hFont,1
         DeleteObject hFont
      Case %WM_LBUTTONDBLCLK
          PostMessage hWndControl,%WM_LBUTTONDOWN,wParam,lParam
          Function = 0
          Exit Function
   End Select
   Function = FF_SubClassOrig(hWndControl,wMsg,wParam,lParam)

End Function


to:


Function HeaderProc( ByVal hWndControl As Dword, _
                       ByVal wMsg   As Dword, _
                       ByVal wParam As Long, _
                       ByVal lParam As Long _
                       ) As Long
   Select Case wMsg
      Case %WM_LBUTTONDBLCLK
          PostMessage hWndControl,%WM_LBUTTONDOWN,wParam,lParam
          Function = 0
          Exit Function
      CASE %HDM_LAYOUT
          LOCAL phdl AS HDLAYOUT PTR
          phdl = lParam
          @phdl.@pwpos.hwnd = hWndControl
          @phdl.@pwpos.flags = %SWP_FRAMECHANGED
          @phdl.@pwpos.x = @phdl.@prc.nLeft
          @phdl.@pwpos.y = 0
          @phdl.@pwpos.cx = @phdl.@prc.nRight - @phdl.@prc.nLeft
          @phdl.@pwpos.cy = 120   ' --> change me
          @phdl.@prc.nTop = 120   ' --> change me
          FUNCTION = -1
          EXIT FUNCTION
   End Select
   Function = FF_SubClassOrig(hWndControl,wMsg,wParam,lParam)

End Function


James Fuller