PlanetSquires Forums

Support Forums => General Board => Topic started by: James Fuller on February 15, 2010, 02:06:12 PM

Title: ListView with muli-line header
Post by: James Fuller on February 15, 2010, 02:06:12 PM
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
Title: Re: ListView with muli-line header
Post by: Roger Garstang on February 15, 2010, 05:41:21 PM
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.
Title: Re: ListView with muli-line header
Post by: Jean-pierre Leroy on February 15, 2010, 05:43:14 PM
Hello James,

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

See the screenshot.

Jean-Pierre
Title: Re: ListView with muli-line header
Post by: James Fuller on February 15, 2010, 06:02:53 PM
No Idea what the problem is.
OS here is Win7(64)

James
Title: Re: ListView with muli-line header
Post by: Rolf Brandt on February 15, 2010, 06:19:17 PM
No headers here either...
Title: Re: ListView with muli-line header
Post by: Jean-pierre Leroy on February 15, 2010, 06:27:39 PM
It works if I disable the "Theme support" for the project.

Jean-Pierre
Title: Re: ListView with muli-line header
Post by: Paul Squires on February 15, 2010, 06:41:40 PM
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.
Title: Re: ListView with muli-line header
Post by: José Roca on February 15, 2010, 10:34:08 PM
 
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.
Title: Re: ListView with muli-line header
Post by: José Roca on February 15, 2010, 11:11:00 PM
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

Title: Re: ListView with muli-line header
Post by: James Fuller on February 16, 2010, 08:09:29 AM
Jose,
  Thank you very much.

James