Jump to content

Listview header height


mpower
 Share

Recommended Posts

So I've posted about this before but never really received a response.

I'm trying to increase the HEIGHT of the ListView header. 

I've found a stackoverflow post about it, but it relates to C# and Visual Studio. (http://stackoverflow.com/questions/3904572/c-sharp-listview-colum-header-height-windows-form)

Unfortunately it is beyond my Autoit Scripting skills to convert/adapt it for Autoit.

Would anyone care to attempt to achieve this in Autoit?

Sample Script below:

#include <GUIConstants.au3>

$iWidth = 800
$iHeight = 600

GUICreate('ListView Header Example', $iWidth, $iHeight, @DesktopWidth/2 - $iWidth/2, @DesktopHeight/2 - $iHeight/2)
$listview = GUICtrlCreateListView('Short header text1|Short header text2|Short header text3|Short header text5|Short header text5|Long header that needs to span accross multiple lines rather than extending column width', 10, 10, $iWidth - 20, $iHeight - 20, _
            Default, BitOR($LVS_EX_CHECKBOXES, $LVS_EX_GRIDLINES, $LVS_EX_DOUBLEBUFFER))
GUISetState()

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

Humble thanks in advance.

 

Link to comment
Share on other sites

Thanks Zedna for the additional information, I have seen that post before also but it went over my head :P

I have looked into it a bit more and I have at least confirmed that sizing the header is possible with WinMove, for example:

#include <GUIConstants.au3>
#include <GuiListView.au3>

$iWidth = 800
$iHeight = 600

GUICreate('ListView Header Example', $iWidth, $iHeight, @DesktopWidth/2 - $iWidth/2, @DesktopHeight/2 - $iHeight/2)
$listview = GUICtrlCreateListView('Short header text1|Short header text2|Short header text3|Short header text5|Short header text5|Long header that needs to span accross multiple lines rather than extending column width', 10, 10, $iWidth - 20, $iHeight - 20, _
            Default, BitOR($LVS_EX_CHECKBOXES, $LVS_EX_GRIDLINES, $LVS_EX_DOUBLEBUFFER))
$header = HWnd(_GUICtrlListView_GetHeader($listview))
WinMove($header, '', Default, Default, Default, 100)
GUISetState()

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

However, with above example, the header position doesn't look right, the text doesn't get wrapped and any time you resize a column the header reverts back to standard header height.

I suspect some sort of GUIRegisterMsg() is required to get this to work properly.

More work is needed.

Edited by mpower
Link to comment
Share on other sites

  • 3 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...