KaFu Posted October 18, 2012 Posted October 18, 2012 (edited) HiHo Forum, I've been playing around with Listview in Tile mode. Populating and switching style works fine, but (at least on the XP machine tested on) the tiles still seem to overlap. Row1 and Row2 look fine, but when you click Row3 you'll see that it overlaps with Row1. Anyone ? Maybe as a bonus question, how do I change to amount of tiles per row (I've not started to look into that)? expandcollapse popup#include <GUIConstantsEx.au3> #include <GuiListView.au3> #include <GuiImageList.au3> #include <WindowsConstants.au3> #include <SendMessage.au3> $GUI = GUICreate("ListView Example - Tile View", 400, 300) $hListView = _GUICtrlListView_Create($GUI, "", 2, 2, 394, 268) _GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_DOUBLEBUFFER, $LVS_EX_FULLROWSELECT)) _GUICtrlListView_InsertColumn($hListView, 0, "Column 1", 100) _GUICtrlListView_InsertColumn($hListView, 1, "Column 2", 100) _GUICtrlListView_InsertColumn($hListView, 2, "Column 3", 100) For $i = 0 To 2 _GUICtrlListView_AddItem($hListView, "Row " & $i + 1 & ": Col 1") _GUICtrlListView_AddSubItem($hListView, $i, "Row " & $i + 1 & ": Col 2", 1) _GUICtrlListView_AddSubItem($hListView, $i, "Row " & $i + 1 & ": Col 3", 2) Next _GUICtrlListView_SetView($hListView, 4) ; [url="http://msdn.microsoft.com/en-us/library/windows/desktop/bb774768(v=vs.85).aspx"]http://msdn.microsoft.com/en-us/library/windows/desktop/bb774768(v=vs.85).aspx[/url] Global $tag_LVTILEVIEWINFO = "UINT cbSize;DWORD dwMask;DWORD dwFlags;STRUCT;LONG Size_cx;LONG Size_cy;ENDSTRUCT;INT cLines;STRUCT;LONG RECT_left;LONG RECT_top;LONG RECT_right;LONG RECT_bottom;ENDSTRUCT;" $t_Struct2 = DllStructCreate($tag_LVTILEVIEWINFO) DllStructSetData($t_Struct2, "cbSize", DllStructGetSize($t_Struct2)) #cs Const LVTVIM_TILESIZE = &H00000001 Const LVTVIM_COLUMNS = &H00000002 Const LVTVIM_LABELMARGIN = &H00000004 #ce DllStructSetData($t_Struct2, "dwMask", BitOR(0x2, 0x4)) #cs public const int LVTVIF_AUTOSIZE = 0; public const int LVTVIF_FIXEDWIDTH = 1; public const int LVTVIF_FIXEDHEIGHT = 2; public const int LVTVIF_FIXEDSIZE = 3; #endregion #ce DllStructSetData($t_Struct2, "dwFlags", 0) DllStructSetData($t_Struct2, "Size_cx", 160) ; Width DllStructSetData($t_Struct2, "Size_cy", 50) ; Height DllStructSetData($t_Struct2, "cLines", 2) ; cLines DllStructSetData($t_Struct2, "RECT_left", 1) ; Margin Left DllStructSetData($t_Struct2, "RECT_top", 10) ; Margin Top DllStructSetData($t_Struct2, "RECT_right", 1) ; Margin Right DllStructSetData($t_Struct2, "RECT_bottom", 10) ; Margin Bottom $p_Struct2 = DllStructGetPtr($t_Struct2) ; [url="http://msdn.microsoft.com/en-us/library/windows/desktop/bb761212(v=vs.85).aspx"]http://msdn.microsoft.com/en-us/library/windows/desktop/bb761212(v=vs.85).aspx[/url] ConsoleWrite(_SendMessage($hListView, $LVM_SETTILEVIEWINFO, 0, $p_Struct2) & @CRLF) For $iItem = 0 To 2 ; [url="http://msdn.microsoft.com/en-us/library/windows/desktop/bb774766(v=vs.85).aspx"]http://msdn.microsoft.com/en-us/library/windows/desktop/bb774766(v=vs.85).aspx[/url] Global $tag_LVTILEINFO = "UINT cbSize;INT iItem;UINT cColumns;PTR puColumns;" ;PTR piColFmt;" $t_Struct = DllStructCreate($tag_LVTILEINFO) DllStructSetData($t_Struct, "cbSize", DllStructGetSize($t_Struct)) ; cbSize DllStructSetData($t_Struct, "iItem", $iItem) ; 0-based DllStructSetData($t_Struct, "cColumns", 2) ; cColumns $t_Struct_Cols = DllStructCreate("int;int") DllStructSetData($t_Struct_Cols, 1, 2) ; show third column first DllStructSetData($t_Struct_Cols, 2, 1) ; show second column last DllStructSetData($t_Struct, "puColumns", DllStructGetPtr($t_Struct_Cols)) $p_Struct = DllStructGetPtr($t_Struct) ; [url="http://msdn.microsoft.com/en-us/library/windows/desktop/bb761210(v=vs.85).aspx"]http://msdn.microsoft.com/en-us/library/windows/desktop/bb761210(v=vs.85).aspx[/url] ConsoleWrite(_SendMessage($hListView, $LVM_SETTILEINFO, 0, $p_Struct) & @CRLF) Next GUISetState() Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() Regards Edited October 18, 2012 by KaFu OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16)
UEZ Posted October 18, 2012 Posted October 18, 2012 Have a look here: Maybe it will solve your problems. Br, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
KaFu Posted October 18, 2012 Author Posted October 18, 2012 Ah, I've seen that in the past, forgot it and reinvented the wheel .. thanks for the hint, but no, sadly it does not seem to work properly (on XP) with that UDF either. OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16)
KaFu Posted October 18, 2012 Author Posted October 18, 2012 (edited) Reordered the calls to LVM_SETTILEVIEWINFO _GUICtrlListView_SetView LVM_SETTILEINFO and now it works ... expandcollapse popup#include <GUIConstantsEx.au3> #include <GuiListView.au3> #include <GuiImageList.au3> #include <WindowsConstants.au3> #include <SendMessage.au3> $GUI = GUICreate("ListView Example - Tile View", 400, 300) $hListView = _GUICtrlListView_Create($GUI, "", 2, 2, 394, 268) _GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_DOUBLEBUFFER, $LVS_EX_FULLROWSELECT)) ; Load images $hImage = _GUIImageList_Create() _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xFF0000, 16, 16)) _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x00FF00, 16, 16)) _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x0000FF, 16, 16)) _GUICtrlListView_SetImageList($hListView, $hImage, 1) _GUICtrlListView_SetImageList($hListView, $hImage, 0) ; for Tile View _GUICtrlListView_InsertColumn($hListView, 0, "Column 1", 100) _GUICtrlListView_InsertColumn($hListView, 1, "Column 2", 100) _GUICtrlListView_InsertColumn($hListView, 2, "Column 3", 100) For $i = 0 To 19 _GUICtrlListView_AddItem($hListView, "Row " & $i + 1 & ": Col 1", mod($i,3)) _GUICtrlListView_AddSubItem($hListView, $i, "Row " & $i + 1 & ": Col 2", 1) _GUICtrlListView_AddSubItem($hListView, $i, "Row " & $i + 1 & ": Col 3", 2) Next ; [url="http://msdn.microsoft.com/en-us/library/windows/desktop/bb774768(v=vs.85).aspx"]http://msdn.microsoft.com/en-us/library/windows/desktop/bb774768(v=vs.85).aspx[/url] Global $tag_LVTILEVIEWINFO = "UINT cbSize;DWORD dwMask;DWORD dwFlags;STRUCT;LONG Size_cx;LONG Size_cy;ENDSTRUCT;INT cLines;STRUCT;LONG RECT_left;LONG RECT_top;LONG RECT_right;LONG RECT_bottom;ENDSTRUCT;" $t_Struct2 = DllStructCreate($tag_LVTILEVIEWINFO) DllStructSetData($t_Struct2, "cbSize", DllStructGetSize($t_Struct2)) #cs Const LVTVIM_TILESIZE = &H00000001 Const LVTVIM_COLUMNS = &H00000002 Const LVTVIM_LABELMARGIN = &H00000004 #ce DllStructSetData($t_Struct2, "dwMask", 7) #cs public const int LVTVIF_AUTOSIZE = 0; public const int LVTVIF_FIXEDWIDTH = 1; public const int LVTVIF_FIXEDHEIGHT = 2; public const int LVTVIF_FIXEDSIZE = 3; #endregion #ce DllStructSetData($t_Struct2, "dwFlags", 3) DllStructSetData($t_Struct2, "Size_cx", 180) ; Width DllStructSetData($t_Struct2, "Size_cy", 80) ; Height DllStructSetData($t_Struct2, "cLines", 2) ; cLines DllStructSetData($t_Struct2, "RECT_left", 10) ; Margin Left DllStructSetData($t_Struct2, "RECT_top", 5) ; Margin Top DllStructSetData($t_Struct2, "RECT_right", 10) ; Margin Right DllStructSetData($t_Struct2, "RECT_bottom", 5) ; Margin Bottom $p_Struct2 = DllStructGetPtr($t_Struct2) ; [url="http://msdn.microsoft.com/en-us/library/windows/desktop/bb761212(v=vs.85).aspx"]http://msdn.microsoft.com/en-us/library/windows/desktop/bb761212(v=vs.85).aspx[/url] ConsoleWrite(_SendMessage($hListView, $LVM_SETTILEVIEWINFO, 0, $p_Struct2) & @CRLF) _GUICtrlListView_SetView($hListView, 4) For $iItem = 0 To 19 ; [url="http://msdn.microsoft.com/en-us/library/windows/desktop/bb774766(v=vs.85).aspx"]http://msdn.microsoft.com/en-us/library/windows/desktop/bb774766(v=vs.85).aspx[/url] Global $tag_LVTILEINFO = "UINT cbSize;INT iItem;UINT cColumns;PTR puColumns;" ;PTR piColFmt;" $t_Struct = DllStructCreate($tag_LVTILEINFO) DllStructSetData($t_Struct, "cbSize", DllStructGetSize($t_Struct)) ; cbSize DllStructSetData($t_Struct, "iItem", $iItem) ; 0-based DllStructSetData($t_Struct, "cColumns", 2) ; cColumns $t_Struct_Cols = DllStructCreate("int;int") DllStructSetData($t_Struct_Cols, 1, 2) ; show third column first DllStructSetData($t_Struct_Cols, 2, 1) ; show second column last DllStructSetData($t_Struct, "puColumns", DllStructGetPtr($t_Struct_Cols)) $p_Struct = DllStructGetPtr($t_Struct) ; [url="http://msdn.microsoft.com/en-us/library/windows/desktop/bb761210(v=vs.85).aspx"]http://msdn.microsoft.com/en-us/library/windows/desktop/bb761210(v=vs.85).aspx[/url] ConsoleWrite(_SendMessage($hListView, $LVM_SETTILEINFO, 0, $p_Struct) & @CRLF) Next _GUICtrlListView_SetColumnWidth($hListView, 0, $LVSCW_AUTOSIZE ) GUISetState() Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() Edited October 18, 2012 by KaFu OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16)
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now